1.
mkdir -p /u01/app/oracle/bak/arch1
mkdir -p /u01/app/oracle/bak/arch2
alter system set log_archive_dest_1='location=/u01/app/oracle/bak/arch1';
alter system set log_archive_dest_2='location=/u01/app/oracle/bak/arch2';
2.
使用dbca建立PROD4数据库,并启动监听器:
lsnrctl start
sqlplus / as sysdba
alter system set db_domain='oracle.com' scope=spfile;
startup force
alter system register;
在PROD4上创建表空间:
create tablespace RCVCAT
datafile '/u01/app/oracle/oradata/PROD4/RCVCAT.dbf' size 200M autoextend on maxsize 2G
extent management local autoallocate
segment space management auto;
3.
create user rc_admin identified by oracle default tablespace rcvcat;
alter user rc_admin quota unlimited on rcvcat;
grant connect, recovery_catalog_owner to rc_admin;
4.
rman catalog rc_admin/oracle
create catalog;
5.
在管理机上:
cd $ORACLE_HOME/network/admin
vi tnsnames.ora
PROD1=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=odd.oracle.com)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=PROD1.oracle.com)
(server=dedicated)
)
)
rman target sys/oracle@prod1 catalog rc_admin/oracle
register database;
在odd上编辑tnsnames.ora文件,添加:
PROD4=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=even.oracle.com)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=PROD4.oracle.com)
(server=dedicated)
)
)
用odd上的11gR2的高版本的RMAN去连接even上的11gR1的低版本的catalog
rman target sys/oracle@prod1 catalog rc_admin/oracle@prod4
upgrade catalog;
upgrade catalog;
升级完毕catalog以后,再连一次catalog确定没有告警信息:
rman target sys/oracle@prod1 catalog rc_admin/oracle@prod4
6. And enable 4 channels when backup the database.
mkdir -p /home/oracle/files/bak
RMAN> configure channel device type disk format '/home/oracle/files/bak/%U';
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/files/bak/%F';
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 5;
CONFIGURE RETENTION POLICY TO recovery window of 7 days;
CONFIGURE BACKUP OPTIMIZATION on;
7.
backup tablespace system section size 200M;
8.
rman target sys/oracle@prod1 catalog rc_admin/oracle@prod4
backup as compressed backupset database keep forever tag 'Q17';
backup archivelog all delete input keep forever tag 'Q17';
backup current controlfile keep forever tag 'Q17';
9.
mkdir -p /u01/app/oracle/admin/PROD2/adump
mkdir -p /u01/app/oracle/oradata/PROD2
mkdir -p /u01/app/oracle/oradata/PROD2/disk1
mkdir -p /u01/app/oracle/oradata/PROD2/disk2
mkdir -p /u01/app/oracle/oradata/PROD2/disk3
orapwd file=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwPROD2 force=y password=oracle ignorecase=n
编辑初始化参数文件:
vi /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPROD2.ora
db_block_size=4096
db_domain="oracle.com"
db_name="PROD2"
instance_name=PROD2
control_files="/u01/app/oracle/oradata/PROD2/control01.ctl"
compatible=11.2.0.0.0
db_file_name_convert='/u01/app/oracle/oradata/PROD1','/u01/app/oracle/oradata/PROD2'
log_file_name_convert='/u01/app/oracle/oradata/PROD1','/u01/app/oracle/oradata/PROD2'
sqlplus / as sysdba
startup nomount;
vi tnsnames.ora
PROD2=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=odd.oracle.com)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=PROD2.oracle.com)
(server=dedicated)
)
)
vi listener.ora
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD1.oracle.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=PROD1)
)
(SID_DESC=
(GLOBAL_DBNAME=PROD2.oracle.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=PROD2)
)
)
rman target sys/oracle@prod auxiliary sys/oracle@prod2
DUPLICATE TARGET DATABASE TO PROD2 from active database;
shutdown immediate;
create spfile from pfile;
startup;
10.
连接到prod2里:
mkdir -p /u01/app/oracle/FRA
alter system set db_recovery_file_dest_size=8G;
alter system set db_recovery_file_dest='/u01/app/oracle/FRA';
11.
连接到prod2里,
alter system set db_flashback_retention_target=720;
alter database flashback on;
12.
rman target sys/oracle@prod2 catalog rc_admin/oracle@prod4
register database;
13.
backup as compressed backupset database plus archivelog delete all input;
backup current controlfile;
backup spfile;
14.
rman target sys/oracle@prod2 catalog rc_admin/oracle@prod4
CREATE GLOBAL SCRIPT global_backup_db { BACKUP DATABASE PLUS ARCHIVELOG; }
15.
mkdir -p /u01/app/oracle/disk1
mkdir -p /u01/app/oracle/disk2
rman target sys/oracle@prod catalog rc_admin/oracle@prod4
run{
ALLOCATE CHANNEL c1 DEVICE TYPE disk format '/u01/app/oracle/disk1/%U';
ALLOCATE CHANNEL c2 DEVICE TYPE disk format '/u01/app/oracle/disk2/%U';
SET BACKUP COPIES 2;
BACKUP ARCHIVELOG all;
}
16.
连接到prod4,设置归档模式,完成备份:
backup database;
17.
连接到prod2
create restore point restore_point_1 guarantee flashback database;
mkdir -p /u01/app/oracle/bak/arch1
mkdir -p /u01/app/oracle/bak/arch2
alter system set log_archive_dest_1='location=/u01/app/oracle/bak/arch1';
alter system set log_archive_dest_2='location=/u01/app/oracle/bak/arch2';
2.
使用dbca建立PROD4数据库,并启动监听器:
lsnrctl start
sqlplus / as sysdba
alter system set db_domain='oracle.com' scope=spfile;
startup force
alter system register;
在PROD4上创建表空间:
create tablespace RCVCAT
datafile '/u01/app/oracle/oradata/PROD4/RCVCAT.dbf' size 200M autoextend on maxsize 2G
extent management local autoallocate
segment space management auto;
3.
create user rc_admin identified by oracle default tablespace rcvcat;
alter user rc_admin quota unlimited on rcvcat;
grant connect, recovery_catalog_owner to rc_admin;
4.
rman catalog rc_admin/oracle
create catalog;
5.
在管理机上:
cd $ORACLE_HOME/network/admin
vi tnsnames.ora
PROD1=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=odd.oracle.com)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=PROD1.oracle.com)
(server=dedicated)
)
)
rman target sys/oracle@prod1 catalog rc_admin/oracle
register database;
在odd上编辑tnsnames.ora文件,添加:
PROD4=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=even.oracle.com)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=PROD4.oracle.com)
(server=dedicated)
)
)
用odd上的11gR2的高版本的RMAN去连接even上的11gR1的低版本的catalog
rman target sys/oracle@prod1 catalog rc_admin/oracle@prod4
upgrade catalog;
upgrade catalog;
升级完毕catalog以后,再连一次catalog确定没有告警信息:
rman target sys/oracle@prod1 catalog rc_admin/oracle@prod4
6. And enable 4 channels when backup the database.
mkdir -p /home/oracle/files/bak
RMAN> configure channel device type disk format '/home/oracle/files/bak/%U';
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/files/bak/%F';
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 5;
CONFIGURE RETENTION POLICY TO recovery window of 7 days;
CONFIGURE BACKUP OPTIMIZATION on;
7.
backup tablespace system section size 200M;
8.
rman target sys/oracle@prod1 catalog rc_admin/oracle@prod4
backup as compressed backupset database keep forever tag 'Q17';
backup archivelog all delete input keep forever tag 'Q17';
backup current controlfile keep forever tag 'Q17';
9.
mkdir -p /u01/app/oracle/admin/PROD2/adump
mkdir -p /u01/app/oracle/oradata/PROD2
mkdir -p /u01/app/oracle/oradata/PROD2/disk1
mkdir -p /u01/app/oracle/oradata/PROD2/disk2
mkdir -p /u01/app/oracle/oradata/PROD2/disk3
orapwd file=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwPROD2 force=y password=oracle ignorecase=n
编辑初始化参数文件:
vi /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPROD2.ora
db_block_size=4096
db_domain="oracle.com"
db_name="PROD2"
instance_name=PROD2
control_files="/u01/app/oracle/oradata/PROD2/control01.ctl"
compatible=11.2.0.0.0
db_file_name_convert='/u01/app/oracle/oradata/PROD1','/u01/app/oracle/oradata/PROD2'
log_file_name_convert='/u01/app/oracle/oradata/PROD1','/u01/app/oracle/oradata/PROD2'
sqlplus / as sysdba
startup nomount;
vi tnsnames.ora
PROD2=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=odd.oracle.com)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=PROD2.oracle.com)
(server=dedicated)
)
)
vi listener.ora
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD1.oracle.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=PROD1)
)
(SID_DESC=
(GLOBAL_DBNAME=PROD2.oracle.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=PROD2)
)
)
rman target sys/oracle@prod auxiliary sys/oracle@prod2
DUPLICATE TARGET DATABASE TO PROD2 from active database;
shutdown immediate;
create spfile from pfile;
startup;
10.
连接到prod2里:
mkdir -p /u01/app/oracle/FRA
alter system set db_recovery_file_dest_size=8G;
alter system set db_recovery_file_dest='/u01/app/oracle/FRA';
11.
连接到prod2里,
alter system set db_flashback_retention_target=720;
alter database flashback on;
12.
rman target sys/oracle@prod2 catalog rc_admin/oracle@prod4
register database;
13.
backup as compressed backupset database plus archivelog delete all input;
backup current controlfile;
backup spfile;
14.
rman target sys/oracle@prod2 catalog rc_admin/oracle@prod4
CREATE GLOBAL SCRIPT global_backup_db { BACKUP DATABASE PLUS ARCHIVELOG; }
15.
mkdir -p /u01/app/oracle/disk1
mkdir -p /u01/app/oracle/disk2
rman target sys/oracle@prod catalog rc_admin/oracle@prod4
run{
ALLOCATE CHANNEL c1 DEVICE TYPE disk format '/u01/app/oracle/disk1/%U';
ALLOCATE CHANNEL c2 DEVICE TYPE disk format '/u01/app/oracle/disk2/%U';
SET BACKUP COPIES 2;
BACKUP ARCHIVELOG all;
}
16.
连接到prod4,设置归档模式,完成备份:
backup database;
17.
连接到prod2
create restore point restore_point_1 guarantee flashback database;