脚本创建Oracle的数据库

Oracle创建数据库可以采取dbca,也可采取手动脚本创建;版本:oracle10.2.1,手动脚本创建数据库的方法总结如下:

注意:相关目录必须先创建,将相关的目录改为自己的目录即可;

Step 1: Decide on Your Instance Identifier (SID)
 
Step 2: Establish the Database Administrator Authentication Method
 
Step 3: Create the Initialization Parameter File and admin directory
            db_block_size=8192
            db_file_multiblock_read_count=16
            open_cursors=300
            db_domain=""
            db_name=orcl
            background_dump_dest=/u01/app/oracle/admin/orcl/bdump
            core_dump_dest=/u01/app/oracle/admin/orcl/cdump
            user_dump_dest=/u01/app/oracle/admin/orcl/udump
            control_files=("/u01/app/oracle/oradata/orcl/control01.ctl",
                           "/u01/app/oracle/oradata/orcl/control02.ctl",
                           "/u01/app/oracle/oradata/orcl/control03.ctl")
            db_recovery_file_dest=/u01/app/oracle/flash_recovery_area
            db_recovery_file_dest_size=2147483648
            compatible=10.2.0.1.0
            processes=150
            sga_target=283115520
            audit_file_dest=/u01/app/oracle/admin/orcl/adump
            remote_login_passwordfile=EXCLUSIVE
            pga_aggregate_target=94371840
            undo_management=AUTO
            undo_tablespace=UNDOTBS1
 
   Step 4: Start the Instance
    STARTUP NOMOUNT
 
   Step 5: Issue the CREATE DATABASE Statement
 
     CREATE DATABASE "orcl"
       MAXINSTANCES 8
       MAXLOGHISTORY 1
       MAXLOGFILES 16
       MAXLOGMEMBERS 3
       MAXDATAFILES 100
       DATAFILE '/u01/app/oracle/oradata/orcl/system01.dbf' SIZE 300M
       EXTENT MANAGEMENT LOCAL
       SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf' SIZE 120M
       SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20M
       SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/app/oracle/oradata/orcl/undotbs01.dbf' SIZE 200M
       CHARACTER SET WE8ISO8859P1
       NATIONAL CHARACTER SET AL16UTF16
       LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/redo01.log') SIZE 51200K,
               GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02.log') SIZE 51200K,
               GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03.log') SIZE 51200K
      USER SYS IDENTIFIED BY "oracle" USER SYSTEM IDENTIFIED BY "oracle";
 
    Step 6: Run Scripts to Build Data Dictionary Views
       CONNECT SYS/password AS SYSDBA
       @$ORACLE_HOME/rdbms/admin/catalog.sql
       @$ORACLE_HOME/rdbms/admin/catproc.sql

相关推荐