????1.3 ??????????????????
????#redologs??datafiles
????mkdir -p /u01/redologs/a && mkdir -p /u01/redologs/b && mkdir -p /u01/oradata03/catdb
????chown oracle:oinstall /u01/redologs/a /u01/redologs/b /u01/oradata03/catdb
????#controlfiles
????mkdir -p /u01/system/catdb && mkdir -p /u02/system/catdb && mkdir -p /u03/system/catdb
????chown oracle:oinstall /u01/system/catdb /u02/system/catdb /u03/system/catdb
????1.4 ??н??????
????1.4.1 ????ORACLE_SID????
????export ORACLE_SID=catdb
????1.4.2 ??????????????
????vi $ORACLE_HOME/dbs/init$ORACLE_SID.ora
????DB_NAME=catdb
????CONTROL_FILES=('/u01/system/catdb/control01.ctl'??'/u02/system/catdb/control02.ctl'??'/u03/system/catdb/control03.ctl')
????MEMORY_TARGET=1G
????1.4.3 ?????????????????????????
?????????????????????????????????????????????
????SQL> create spfile from pfile;
????SQL> startup nomount
????1.4.4 ???н?????????
????SQL> @/home/oracle/create_db.sql
????Database created.
????????????????:
????@?/rdbms/admin/catalog.sql
????@?/rdbms/admin/catproc.sql
????conn system/oracle
????@?/sqlplus/admin/pupbld.sql
????1.4.5 ????tnsnames.ora
????CATDB =
????(DESCRIPTION =
????(ADDRESS = (PROTOCOL = TCP)(HOST = JY-DB02)(PORT = 1521))
????(CONNECT_DATA =
????(SERVER = DEDICATED)
????(SERVICE_NAME = catdb)
????)
????)
????????????catdb?catalog?????
????2.1 ????????
????CREATE TABLESPACE TOOLS DATAFILE '/u01/oradata03/catdb/tools.dbf' SIZE 15M REUSE AUTOEXTEND ON NEXT 15M MAXSIZE 1500M;
????2.2 ???????
????CREATE USER rman IDENTIFIED BY rman
????TEMPORARY TABLESPACE tempts1
????DEFAULT TABLESPACE tools
????QUOTA UNLIMITED ON tools;
????GRANT RECOVERY_CATALOG_OWNER TO rman;
????2.3 ????CATALOG
????$ rman catalog rman/rman
????RMAN> CREATE CATALOG;
????2.4 ???????????CATALOG
?????????????????:
????rman TARGET / CATALOG rman@catdb
????REGISTER DATABASE;
????????????catalog?????
????3.1 ?????????VPC(virtual private catalogs)
????3.1.1 ????????????????
????create tablespace vpcusers datafile '/u01/oradata03/catdb/vpcusers01.dbf' size 30M autoextend on maxsize 300M;
????CREATE USER vpc1 IDENTIFIED BY vpc1 DEFAULT TABLESPACE vpcusers QUOTA UNLIMITED ON vpcusers;
????GRANT recovery_catalog_owner TO vpc1;
????3.1.2 ???????????RMAN???????vpc1??????????????
????$ rman catalog rman/rman@catdb
????RMAN> GRANT REGISTER DATABASE TO vpc1;
????3.1.3 ?????????RMAN???????????CATALOG
????RMAN> CONNECT CATALOG vpc1@catdb;
????RMAN>  CREATE VIRTUAL CATALOG;
?????????10.2?汾????磬???SQL????д洢?????????
????SQL> EXECUTE base_catalog_owner.DBMS_RCVCAT.CREATE_VIRTUAL_CATALOG;
????3.1.4 ???????????RMAN???????vpc1????????????????????
????$ rman catalog rman/rman@catdb
????RMAN> GRANT CATALOG FOR DATABASE jingyu TO vpc1;
????3.2 ?????????洢???
????????????????????????????
????3.2.1 ?????????
????CREATE GLOBAL SCRIPT global_full_backup
????{
????BACKUP DATABASE PLUS ARCHIVELOG;
????DELETE OBSOLETE;
????}
????????????????????????????????????磺
????CREATE GLOBAL SCRIPT global_full_backup
????COMMENT 'use only with ARCHIVELOG mode databases'
????{
????BACKUP DATABASE PLUS ARCHIVELOG;
????DELETE OBSOLETE;
????}
????3.2.2 ??????????
????CREATE SCRIPT full_backup
????{
????BACKUP DATABASE PLUS ARCHIVELOG;
????DELETE OBSOLETE;
????}
?????????????????????н?????????????
????CREATE SCRIPT full_backup
????FROM FILE '/tmp/my_script_file.txt';
????3.2.3 ?滻?洢???
????REPLACE GLOBAL SCRIPT global_full_backup
????COMMENT 'A script for full backup to be used with any database'
????{
????BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;
????}
????3.2.4 ??д洢???
????RUN
????{
????EXECUTE GLOBAL SCRIPT global_full_backup;
????}
????RUN
????{
????EXECUTE SCRIPT global_full_backup;
????}
?????????б???????global_full_backup???????????????????????Ч???????????У??????????????????????б???????
????3.2.5 ????????????洢???
???????RMAN
????rman TARGET / CATALOG rman@catdb USING arc_backup bck0906 FY06Q3
????????????洢?????
????CREATE SCRIPT quarterly {
????ALLOCATE CHANNEL c1
????DEVICE TYPE sbt
????PARMS 'ENV=(OB_MEDIA_FAMILY=&1)';
????BACKUP
????TAG &2
????FORMAT '/disk2/bck/&1%U.bck'
????KEEP FOREVER
????RESTORE POINT &3
????DATABASE;
????}
?????滻?????????????????е??
????Replace SCRIPT quarterly {
????ALLOCATE CHANNEL c1
????DEVICE TYPE disk;
????BACKUP
????TAG '&2'
????FORMAT '/u01/jingyu/&1%U.bck'
????KEEP FOREVER
????RESTORE POINT '&3'
????DATABASE;
????}
??????У?
????RUN
????{
????EXECUTE SCRIPT quarterly
????USING arc_backup
????bck1206
????FY06Q4;
????}
????3.2.6 ????洢???
????????洢?????
????PRINT SCRIPT full_backup;
????????????????????
????PRINT SCRIPT full_backup
????TO FILE '/tmp/my_script_file.txt';
????3.3 ????????
?????????catalog????????????????????
????RMAN> drop catalog;
????RMAN> drop catalog;
????3.4 ????????
????????RMAN??????汾??10g?????11g?汾??RMAN???????????????±??????????
?????????10gR1?汾?????????????? ????RECOVERY_CATALOG_OWNER?????????CREATE TYPE??????????????CREATE TYPE??????????????????
????SQL> GRANT CREATE TYPE TO rman;
????????catalog????????????
????RMAN> upgrade catalog;
????RMAN> upgrade catalog;
???????Reference
????Oracle? Database Backup and Recovery User's Guide 11g Release 2 (11.2)
????OCP ?????????? (1Z0-053)[M]. ?廩????????磬 2010.