Reference: http://blog.csdn.net/huzia/article/details/7616717
Create environment variables, determine SID
$ vim Rman. Env export Oracle_sid=rmanexport oracle_base=/opt/oracleexportoracle_home =/opt/oracle/11g
Load Environment variables
$ source Rman. Env
Creating an initialization file
CP/opt/oracle/11g/dbs/init.ora/opt/oracle/11g/dbs/Initrman.oradb_name='Rman'Memory_target=1Gprocesses= Maxaudit_file_dest='/opt/oracle/admin/rman/adump'Audit_trail='DB'db_block_size=8192Db_domain="'db_recovery_file_dest='/opt/oracle/flash_recovery_area'db_recovery_file_dest_size=2gdiagnostic_dest='/opt/oracle'Dispatchers='(PROTOCOL=TCP) (SERVICE=RMANXDB)'open_cursors= -Remote_login_passwordfile='EXCLUSIVE'Undo_tablespace='UNDOTBS1'# want to ensure that control files is created on separate physical# devicescontrol_files= ('/opt/oracle/oradata/rman/control01.ctl','/opt/oracle/flash_recovery_area/rman/control02.ctl') compatible='11.2.0'You can also generate initialization files based on the spfile of existing data #strings/opt/oracle/11g/dbs/spfilezgw.ora >/opt/oracle/11g/dbs/initrman.ora
Create a Directory
mkdir -p/opt/oracle/admin/rman/adumpmkdir -p/opt/oracle/oradata/rman mkdir -p/opt/oracle/flash_recovery_area/rman
Login Sqlplus
Sqlplus/as SYSDBA
Create a dbsql statementCREATE DATABASERman controlfile reuselogfile'/opt/oracle/oradata/rman/redo01.log'SIZE 10M Reuse,'/opt/oracle/oradata/rman/redo02.log'SIZE 10M Reuse,'/opt/oracle/oradata/rman/redo03.log'SIZE 10M Reuse,'/opt/oracle/oradata/rman/redo04.log'SIZE 10M reuse,datafile'/opt/oracle/oradata/rman/system01.dbf'SIZE 50M Reuse Autoextend on NEXT10M MAXSIZE 200M UNDO tablespace UNDOTBS1 datafile'/opt/oracle/oradata/rman/undo01.dbf'size 10mSYSAUX datafile'/opt/oracle/oradata/rman/sysaux.dbf'Size 10M Autoextend on Next50m maxsize 100mCHARACTER SETWE8ISO8859P1;
The function of the above paragraph is as follows:
① Create data files for the database;
② Create a control file for the database;
③ Create a redo log file for the database;
④ Create system table space and rollback segment;
⑤ Create data directory;
⑥ create user sys and system;
⑦ the character set that stores data in the specified database;
⑧ loading, opening the database
Create a system rollback segment, create a temporary rollback segment to support the creation of the database, and then delete it.
CREATE ROLLBACKSEGMENT rb_temp STORAGE (INITIAL 100kNEXT250k);ALTER ROLLBACKSEGMENT RB1 ONLINE; Create a tablespace for a rollback segmentCREATETablespace RBS datafile'/opt/oracle/oradata/rman/rbs01.dbf'SIZE 5M Reuse Autoextend on NEXT5M MAXSIZE 150M; Create user table SpaceCREATETablespace users DataFile'/opt/oracle/oradata/rman/user01.dbf'SIZE 3M reuseautoextend on NEXT5M MAXSIZE 150M; creating a temporary table spaceCREATETablespaceTempDataFile'/opt/oracle/oradata/rman/temp01.dbf'SIZE 2M Reuse Autoextend on NEXT5M MAXSIZE 150M; create rollback segmentCREATE ROLLBACKSEGMENT Rb1 STORAGE (INITIAL 50kNEXT250k) tablespace RBS;CREATE ROLLBACKSEGMENT rb2 STORAGE (INITIAL 50kNEXT250k) tablespace RBS;CREATE ROLLBACKSEGMENT rb3 STORAGE (INITIAL 50kNEXT250k) tablespace RBS;CREATE ROLLBACKSEGMENT rb4 STORAGE (INITIAL 50kNEXT250k) tablespace RBS; bring the rollback segment you just created onlineALTER ROLLBACKSEGMENT Rb1 ONLINE;ALTER ROLLBACKSEGMENT rb2 ONLINE;ALTER ROLLBACKSEGMENT rb3 ONLINE;ALTER ROLLBACKSEGMENT rb4 ONLINE;ALTER ROLLBACKSEGMENT rb_temp OFFLINE;DROP ROLLBACKSEGMENT rb_temp;
Perform data dictionary creation and PLSQL support in the database open state
Sql>@/Opt/Oracle/11g/Rdbms/Admin/Catalog.sqlsql>@/Opt/Oracle/11g/Rdbms/Admin/Catproc.sqlsql>@/Opt/Oracle/11g/Sqlplus/Admin/Pupbld.sql
Create an Oracle database manually