Oracle 11g r2基於OMF方式手工建立資料庫

luashin發表於2016-01-28
1)、使用OMF特性可以幫助我們最快的完成手工建立資料庫
2)、藉助聯機文件路徑:Database Administration -> Administrator's Guide -> 2 Creating and Configuring an Oracle Database
Step 1: Specify an Instance Identifier (SID)
[oralce@localhost]$ export $ORACLE_SID=ORCL

Step 2: Ensure That the Required Environment Variables Are Set
[oralce@localhost]$ vim .bash_profile
export $ORACLE_SID=ORCL
export $ORACLE_BASE=/u01/app/oracle
export $ORACLE_HOME=$ORACLE_BASE/produce/11.2.0/dbhome_1
export PATH=.:$PATH:/usr/sbin:$ORACLE_HOME/bin:$HOME/bin

[oralce@localhost]$ source ./bash_profile


Step 3: Choose a Database Administrator Authentication Method
[oralce@localhost]$ cd $ORACLE_HOME/bin
[oralce@localhost]$ orapwd file=?/dbs/orapwORCL password=oracle entries=30 force=y 
[oralce@localhost]$ mkdir -p /u01/app/oracle/oradata/ORCL/

Step 4: Create the Initialization Parameter File
[oralce@localhost]$ cd $ORACLE_HOME/dbs
[oralce@localhost]$ vim initORCL.ora
DB_NAME=ORCL
instance_name=ORCL
control_files='/u01/app/oracle/oradata/ORCL/control01.ctl','/u01/app/oracle/oradata/ORCL/control02.ctl'
sga_target=600M

Step 5: (Windows Only) Create an Instance  //Windows系統必須建立,Linux系統不需建立

Step 6: Connect to the Instance
[oralce@localhost]$ cd $ORACLE_HOE/bin
[oralce@localhost]$ ./sqlplus / as sysdba;
SQL>

Step 7: Create a Server Parameter File
[oralce@localhost]$ ./sqlplus sys/oracle as sysdba;
SQL> startup;
SQL> create spfile from pfile;

Step 8: Start the Instance
SQL> startup force;
SQL> show parameters db_unique_name;
SQL> show parameters instance_name;

9、Issue the CREATE DATABASE Statement
建立資料庫0分點:
1)、Instance_name大小寫敏感
2)、建立時預設Oracle_Home位於GC下面
3)、忘記建立control file
4)、忘記新增UNDO與TEMP表空間或者沒有開啟檔案大小自動擴充套件功能
5)、採用了MEMORY_TARGET引數而沒有足夠的記憶體
6)、所給的init檔案可能並非是在要求安裝的機器上
7)、忘記create spfile from pfile
8)、從聯機文件樣本檔案複製的文字、命令可能含有跳脫字元
9)、忘記建立臨時表空間
建立資料庫採用OMF方式是最快的方式
db_create_file_dest
db_create_online_log_dest_1
db_recovery_file_dest
建立資料庫使用哪一個最方便?
SQL> show parameter db_c
SQL> alter system set db_create_file_dest='/u01/app/oracle/oradata/ORCL';
SQL> CREATE DATABASE CHARACTER SET ZHS16GBK EXTENT MANAGEMENT LOCAL;
CREATE DATABASE會自動建立system、sysaux、undo、temp表空間
SQL> select * from dba_data_files; //查詢報錯證明資料字典沒有建立

Step 10: Create Additional Tablespaces
SQL> CREATE TABLESPACE users LOGGING DATAFILE '/u01/app/oracle/oradata/ORCL/users01.dbf' SIZE 500M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL;
-- create a tablespace for indexes, separate from user tablespace (optional)
SQL> CREATE TABLESPACE indx_users LOGGING DATAFILE '/u01/app/oracle/oradata/ORCL/indx01.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL;

Step 11: Run Scripts to Build Data Dictionary Views
SQL> @?/rdbms/admin/catalog.sql
SQL> select * from dba_tables;
SQL> @?/rdbms/admin/catproc.sql
In SQL*Plus, connect to your Oracle Database instance as SYSTEM user:
SQL> alter user system identified by oralce;
SQL> conn system/oracle;
SQL> @?/sqlplus/admin/pupbld.sql

Step 12: (Optional) Run Scripts to Install Additional Options
Step 13: Back Up the Database.
Step 14: (Optional) Enable Automatic Instance Startup

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9034054/viewspace-1983712/,如需轉載,請註明出處,否則將追究法律責任。

相關文章