DG常见运维命令及常见问题解决方法 l> DG库启动、关闭标准操作 1 alter database recover managed standby database cancel;
1 Shutdown immediate; Dataguard开启 1 startup nomount;
1 alter database mount standby database;
1 alter database recover managed standby database disconnect from session using current logfile; 2> DG监听、TNS配置及说明
1 1、 监听、TNS配置路径 2 $ORACLE_HOME/network/admin 3 2、 监听配置 4 SID_LIST_oradb = 5 (SID_LIST = 6 (SID_DESC = 7 (GLOBAL_DBNAME = oradb) 8 (ORACLE_HOME = $ORACLE_HOME) 9 (SID_NAME = oradb) 10 ) 11 ) 12 13 oradb = 14 (DESCRIPTION = 15 (ADDRESS = (PROTOCOL = TCP)(HOST = ip )(PORT = 1521)) 16 )
3、 TNS配置
1 oradb_primary = 2 (DESCRIPTION = 3 (ADDRESS_LIST = 4 (ADDRESS = (PROTOCOL = TCP)(HOST = primary_ip)(PORT = 1521)) 5 ) 6 (CONNECT_DATA = 7 (SERVICE_NAME = oradb) 8 ) 9 ) 10 11 oradb_standby = 12 (DESCRIPTION = 13 (ADDRESS_LIST = 14 (ADDRESS = (PROTOCOL = TCP)(HOST = standby_ip)(PORT = 1521)) 15 ) 16 (CONNECT_DATA = 17 (SERVICE_NAME = oradb) 18 ) 19 )
3> DG归档文件系统使用率100%解决办法
1 select PROCESS,STATUS,SEQUENCE#,BLOCKS from V$MANAGED_STANDBY; 2 用SEQUENCE#去和主库对 MRP0为日志应用进程 RFS为日志传输进程 3 PROCESS STATUS SEQUENCE# BLOCKS 4 --------- ------------ ---------- ---------- 5 ARCH CLOSING 116489 1063 6 ARCH CONNECTED 0 0 7 ARCH CLOSING 116491 200 8 ARCH CLOSING 116490 1642 9 MRP0 APPLYING_LOG 116492 4194304
(2)、查看是否部署了删除归档日志脚本,欧博注册如果存在,手工执行脚本删除过期日志 4> DG GAP问题分析解决办法
1 SQL> select PROCESS,STATUS,SEQUENCE#,BLOCKS from V$MANAGED_STANDBY; 2 3 PROCESS STATUS SEQUENCE# BLOCKS 4 --------- ------------ ---------- ---------- 5 ARCH CLOSING 511899 1971 6 ARCH CLOSING 511892 308 7 ARCH CLOSING 511895 1399 8 ARCH CLOSING 511887 1404 9 ARCH CONNECTED 0 0 10 ARCH CLOSING 511900 1591 11 MRP0 WAIT_FOR_GAP 511901 0 12 RFS IDLE 0 0
2、 GAP原因分析 3、 常规GAP解决办法
1 1) 在主库查找所缺日志的备份片 2 select 'catalog device type '|| '''SBT_TAPE''' ||' backuppiece ''/'||HANDLE||''';' from 3 (select distinct a.HANDLE from v$backup_piece_details a, v$backup_archivelog_details b 4 where set_count = id2 and b.thread#=1 and b.SEQUENCE# >缺失的sequence号 and b.SEQUENCE#<缺失的sequence号) ; 5 6 2)、在DG库上注册备份集 7 rman target / 8 configure CHANNEL device type 'SBT_TAPE' PARMS 'ENV=(NB_ORA_CLIENT=主机名)'; 9 catalog device type 'SBT_TAPE' backuppiece '/al_XXXXXXXXXXXXXXXXX'; 10 3)、注册完了 第一个配置的参数清除下 11 CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' CLEAR; 12 使用oracle用户rman target / 13 RMAN>catalog start with '归档路径'; 14 3)检查日志是否开始应用
l DG库ORA-01111错误处理 1 alter system set standby_file_management=manual; 2 alter database create datafile '/u01/oracle/product/db11gr2/dbs/UNNAMED00070' as '/oradb/datafile/oradb/oradb.dbf'; 3 alter system set standby_file_management=auto; 4 打开应用: 5 alter database recover managed standby database parallel 4 disconnect from session;
1 SQL> select dest_name,status,error from v$archive_dest; 2 DEST_NAME STATUS ERROR 3 ------------------------------ -------------------------------------- 4 LOG_ARCHIVE_DEST_1 VALID 5 6 LOG_ARCHIVE_DEST_2 ERROR ORA-03113: end-of-file on communication channel 解决办法:在主库执行 1 SQL> alter system set log_archive_dest_state_2= enable;
2、 ORA-01031: insufficient privileges错误 1 SQL> select dest_name,status,error from v$archive_dest; 2 DEST_NAME STATUS ERROR 3 ---------------------- ----------------------------------------------- 4 LOG_ARCHIVE_DEST_1 VALID 5 LOG_ARCHIVE_DEST_2 ERROR ORA-01031: insufficient Privileges
1 SQL> alter system set log_archive_dest_state_2= enable;
1 SQL> select dest_name,status,error from v$archive_dest; 2 DEST_NAME STATUS ERROR 3 ------------------------------ ----------- 4 LOG_ARCHIVE_DEST_1 VALID 5 LOG_ARCHIVE_DEST_2 ERROR ORA-16191: Primary log shipping client not logged on standby
1 SQL> alter system set log_archive_dest_state_1= enable; 注意事项 建议在主备库的涉及到名称地方都统一用小写字母,避免在配置过程出现莫名的错误。 |