时间:2021-07-01 10:21:17 帮助过:77人阅读
使用rman的duplicate来创建备库,过程简洁了不少,无需在手动创建备库控制文件。 主库SPFILE *.log_archive_format=
使用rman的duplicate来创建备库,,过程简洁了不少,无需在手动创建备库控制文件。
主库SPFILE
*.log_archive_format='%T%S%r.ARC'
*.DB_UNIQUE_NAME='primary'
*.log_archive_config='DG_CONFIG=(primary,standby)'
*.log_archive_dest_1='location=C:/Oracle/product/10.2.0/oradata/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary'
*.log_archive_dest_2='SERVICE=standby arch ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
*.STANDBY_FILE_MANAGEMENT=AUTO
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.FAL_SERVER='standby'
*.FAL_CLIENT='primary'
备库SPFILE 在主库创建SPFILE给备库 并修改
*.log_archive_format='%T%S%r.ARC'
*.DB_UNIQUE_NAME='standby'
*.log_archive_config='DG_CONFIG=(primary,standby)'
*.log_archive_dest_1='location=C:/oracle/product/10.2.0/oradata/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.log_archive_dest_2='SERVICE=primary arch ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary'
*.STANDBY_FILE_MANAGEMENT=AUTO
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.FAL_SERVER='primary'
*.FAL_CLIENT='standby'
配置好TNS 监听能互相TNSPING通
主库操作
修改LOGFILE大小为100M,添加4组备用联机日志
SQL> alter database add logfile group 4 'c:\oracle\product\10.2.0\oradata\orcl\r
edolog04.log' size 50M;
SQL> alter database add logfile group 5 'c:\oracle\product\10.2.0\oradata\orcl\r
edolog05.log' size 50M;
SQL> alter system switch logfile;
SQL> alter database drop logfile group 1;
SQL> alter database drop logfile group 2;
SQL> alter database drop logfile group 3;
SQL> alter database add logfile group 2 'c:\oracle\product\10.2.0\oradata\orcl\r
edolog02.log' size 100M;
SQL> alter database add logfile group 3 'c:\oracle\product\10.2.0\oradata\orcl\r
edolog03.log' size 100M;
SQL> alter database drop logfile group 4;
SQL> select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- --------------------------------
1 15 CURRENT
2 0 UNUSED
3 0 UNUSED
5 14 ACTIVE
SQL> alter system switch logfile;
SQL> select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- --------------------------------
1 19 INACTIVE
2 20 ACTIVE
3 21 CURRENT
5 18 INACTIVE
SQL> alter database drop logfile group 5;
数据库已更改。
SQL> select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- --------------------------------
1 19 INACTIVE
2 20 ACTIVE
3 21 CURRENT
SQL> alter database add standby logfile group 4 'c:\oracle\product\10.2.0\oradat
a\orcl\standbylog04.log' size 50M;
数据库已更改。
SQL> alter database add standby logfile group 5 'c:\oracle\product\10.2.0\oradat
a\orcl\standbylog05.log' size 50M;
数据库已更改。
SQL> alter database add standby logfile group 6 'c:\oracle\product\10.2.0\oradat
a\orcl\standbylog06.log' size 50M;
数据库已更改。
SQL> alter database add standby logfile group 7 'c:\oracle\product\10.2.0\oradat
a\orcl\standbylog07.log' size 50M;
数据库已更改。
-- 添加日志组成员方法
SQL> alter database add logfile member 'c:\oracle\product\10.2.0\oradata\orcl\re
dolog012.log' to group 1;
数据库已更改。
--删除日志组成员方法
SQL> alter database drop logfile member 'c:\oracle\product\10.2.0\oradata\orcl\
redolog012.log';
数据库已更改。
RMAN全备数据库 控制文件 归档日志
RMAN> backup full format 'c:\backup\fullbackup_%d_%T_%s.bak' database include cu
rrent controlfile for standby;
RMAN> sql 'alter system archive log current';
sql 语句: alter system archive log current
RMAN> backup archivelog all format 'c:\backup\archive_%d_%T_%s';
更多详情见请继续阅读下一页的精彩内容:
推荐阅读:
Oracle基础教程之通过RMAN复制数据库
RMAN备份策略制定参考内容
RMAN备份学习笔记
Oracle数据库备份加密 RMAN加密