1、归档模式
1)开启归档模式
查看是否处于归档模式
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 48
Current log sequence 50
关闭数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
启动到mount模式
SQL> startup mount
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2253784 bytes
Variable Size 989858856 bytes
Database Buffers 654311424 bytes
Redo Buffers 7094272 bytes
Database mounted.
设置归档
SQL> ALTER DATABASE ARCHIVELOG;
Database altered.
再次查看是否归档模式
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 48
Next log sequence to archive 50
Current log sequence 50
开启数据库
SQL> alter database open;
Database altered.
归档的重做日志参数:log_archive_dest_n
2)设置归档目录
查看一下目前归档状态,归档为FRA目录
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 89
Next log sequence to archive 92
Current log sequence 92
目前归档状态
SQL> show parameter arch
NAME TYPE VALUE
----------------------------------------------- ------------------------------
archive_lag_target integer 0
log_archive_config string
log_archive_dest string
log_archive_dest_1 string
…..
NAME TYPE VALUE
----------------------------------------------- ------------------------------
log_archive_format string %t_%s_%r.dbf
log_archive_local_first boolean TRUE
log_archive_max_processes integer 4
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
standby_archive_dest string ?/dbs/arch
把当前日志归档一下
SQL> alter system archive log current;
System altered.
在FRA的目录中查看到了刚刚的归档日志
[oracle@localhost 2016_01_08]$ pwd
/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2016_01_08
[oracle@localhost 2016_01_08]$ ll
total 16480
-rw-r----- 1 oracle oinstall 16873984Jan 8 21:09 o1_mf_1_92_c8zf89tp_.arc
设置归档目录为/u01/app/oracle/arch,归档名称以arch开头
SQL> alter system set log_archive_dest_1='location=/u01/app/oracle/arch/arch' scope=spfile;
System altered.
查看归档目录改变为了/u01/app/oracle/arch/arch
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/arch/arch
Oldest online log sequence 90
Next log sequence to archive 93
Current log sequence 93
把当前日志归档一下
SQL> alter system archive log current;
System altered.
在刚才设置的目录中查看到了归档日志
[oracle@localhost arch]$ pwd
/u01/app/oracle/arch
[oracle@localhost arch]$ ll
total 188
-rw-r----- 1 oracle oinstall 191488Jan 8 21:11 arch1_93_896805461.dbf
2、重做日志
新增一个重做日志
SQL> alter database add logfile group 4 '/u01/app/oracle/oradata/orcl/redo04.log' size 100m;
Database altered.
日志:状态
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 INACTIVE
2 CURRENT
3 INACTIVE
4 UNUSED
Current:正在使用,LGWR进程把redo logbuffer日志写入到日志组中
Active:该组是活动的但不是当前组,是等待归档,或者数据没有写入到数据文件中
Inactive:已被归档,可被覆盖
Unused:从未被使用的日志,新加入的日志
日志文件:
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- -------------
3 /u01/app/oracle/oradata/orcl/redo03.log
2 /u01/app/oracle/oradata/orcl/redo02.log
1 /u01/app/oracle/oradata/orcl/redo01.log
4 /u01/app/oracle/oradata/orcl/redo04.log
3、rman备份
[oracle@localhost dbs]$ rman target /
1)rman备份
全库备份:
RMAN> backup database;
Starting backup at 24-NOV-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=68 device type=DISK
channel ORA_DISK_1: starting full datafilebackup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile filenumber=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile filenumber=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile filenumber=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile filenumber=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at24-NOV-15
channel ORA_DISK_1: finished piece 1 at24-NOV-15
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_11_24/o1_mf_nnndf_TAG20151124T133505_c57xrb5w_.bkptag=TAG20151124T133505 comment=NONE
channel ORA_DISK_1: backup set complete,elapsed time: 00:00:55
channel ORA_DISK_1: starting full datafilebackup set
channel ORA_DISK_1: specifying datafile(s)in backup set
includingcurrent control file in backup set
includingcurrent SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at24-NOV-15
channel ORA_DISK_1: finished piece 1 at24-NOV-15
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_11_24/o1_mf_ncsnf_TAG20151124T133505_c57xt27m_.bkptag=TAG20151124T133505 comment=NONE
channel ORA_DISK_1: backup set complete,elapsed time: 00:00:01
Finished backup at 24-NOV-15
指定目录存储:
RMAN> backup database format '/u01/app/oracle/backup/bak_%U'
查看数据库备份:
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device TypeElapsed Time Completion Time
------- ---- -- ---------- ----------------------- ---------------
1 Full 1.12G DISK 00:00:49 24-NOV-15
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20151124T133505
Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_11_24/o1_mf_nnndf_TAG20151124T133505_c57xrb5w_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN CkpTime Name
---- -- ---- ---------- --------- ----
1 Full 1687705 24-NOV-15/u01/app/oracle/oradata/orcl/system01.dbf
2 Full 1687705 24-NOV-15/u01/app/oracle/oradata/orcl/sysaux01.dbf
3 Full 1687705 24-NOV-15/u01/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 1687705 24-NOV-15/u01/app/oracle/oradata/orcl/users01.dbf
BS Key Type LV Size Device TypeElapsed Time Completion Time
------- ---- -- ---------- ----------------------- ---------------
3 Full 1.12G DISK 00:00:46 24-NOV-15
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20151124T134019
Piece Name: /u01/app/oracle/backup/bak_03qn2ne3_1_1
List of Datafiles in backup set 3
File LV Type Ckp SCN CkpTime Name
---- -- ---- ---------- --------- ----
1 Full 1688023 24-NOV-15/u01/app/oracle/oradata/orcl/system01.dbf
2 Full 1688023 24-NOV-15 /u01/app/oracle/oradata/orcl/sysaux01.dbf
3 Full 1688023 24-NOV-15/u01/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 1688023 24-NOV-15/u01/app/oracle/oradata/orcl/users01.dbf
删除备份:
RMAN> delete backupset 1;
备份表空间:
RMAN> backup tablespace users;
RMAN> list backup of tablespace users;
备份数据文件
RMAN> backup datafile 1;
RMAN> list backup of datafile 1;
备份控制文件:
RMAN> backup current controlfile;
RMAN> list backup of controlfile;
设置自动备份控制文件:
RMAN> configure controlfile autobackupon;
备份归档日志:
RMAN> backup archivelog all;
RMAN> list backup of archivelog all;
plus archivelog:
进行日志归档,备份归档日志,备份指定项(当前控制文件),再次进行日志归档,对新生成未备份过的归档日志再次备份
RMAN> backup current controlfile plus archivelog;
备份参数文件:
RMAN> backup spfile;
查看rman备份策略:
RMAN> show all;
RMAN configuration parameters for databasewith db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;# default
CONFIGURE BACKUP OPTIMIZATION OFF; #default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; #default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FORDEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICETYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FORDEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; #default
CONFIGURE ENCRYPTION FOR DATABASE OFF; #default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; #default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' ASOF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TONONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO'/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f'; # default
注:有# default表示是初始值,未被修改过
所有归档日志:
RMAN> list archivelog all;
报告冗余的备份
RMAN> report obsolete;
删除过期冗余备份:
RMAN> delete obsolete;
核查备份:
RMAN> crosscheck backup;
列出无效备份:
RMAN> list expired backup;
删除无效备份:
RMAN> delete expired backup;
报告需要备份:
RMAN> report need backup;
2)增量备份
建立0级备份(容量等于全库备份)
RMAN> backup incremental level=0database;
为users表空间建立1级增量备份
RMAN> backup incremental level=1 tablespace users;
增量的两种备份类型: DIFFERENTIAL差异和 CUMULATIVE累计
数据库1级增量备份(累计变化的)
RMAN> backup incremental level=1 cumulative database;
3)块修改跟踪
查看是否开启块修改跟踪:
SQL> select status from v$block_change_tracking;
STATUS
----------
DISABLED
开启块修改跟踪
SQL> alter database enable block change tracking using file '/u01/app/oracle/trk_file';
注:关闭块修改跟踪
SQL> alter database disable block change tracking;
4、rman备份策略
1)rman备份策略
基于时间和冗余数量 的两种策略
设置基于时间的备份策略,这里设置最早可恢复到5天内前的数据
RMAN> configure retention policy to recovery window of 5 days;
注意control_file_record_keep_time参数,最好 大于 你要恢复的时间
控制文件的最短保留时间参数:
SQL> show parameter control_file_record_keep_time;
NAME TYPE VALUE
----------------------------------------------- ------------------------------
control_file_record_keep_time integer 7
设置基于冗余数量的备份策略,这里设置冗余2份
RMAN> configure retention policy to redundancy 2;
不设置任何备份策略:
RMAN> configure retention policy to none;
2)复合备份
RMAN> backup copies 3 database;
将数据文件和归档日志复制两份的策略:
RMAN> configure default device type todisk;
RMAN> configure datafile backup copiesfor device type disk to 2;
RMAN> configure archivelog backup copiesfor device type disk to 2;
备份数据库(复合备份最好指定唯一的命名规则,可参照附1)
RMAN> backup database format '/u01/app/oracle/backup/bak_%U';
指定通道的备份集:
RMAN> run{
2> allocate channel c1 device type disk format '/u01/app/oracle/backup/cn_%U';
3> backup tablespace users;
4> }
不指定通道,自动分配情况:
RMAN> backup tablespace users format '/u01/app/oracle/backup/cn_%U';
3)带tag标签的备份
RMAN> backup tablespace users tag tab_usersbak;
查看一下备份:
[oracle@localhost 2015_11_25]$ ll
total 1408
-rw-r----- 1 oracle oinstall 1441792 Nov 2509:19 o1_mf_nnndf_TAB_USERSBAK_c5b35v0t_.bkp
Maxpiecesize 指定备份片段大小:
RMAN> run{
2> allocate channel c1 device type disk maxpiecesize=10M format '/u01/app/oracle/fast_recovery_area/ORCL/backupset/2015_11_25/bak_%U';
3> backup tablespace system;
4> }
4)压缩备份
RMAN> backup as compressed backupset database;
再正常备份一遍
RMAN> backup database;
比较两份备份文件的大小:
RMAN> list backup of database;
5、recovery catalog 恢复目录
需要rman备份数据库的服务器:192.168.103.110
创建recovery catalog恢复目录的数据库服务器:192.168.103.109
1)recoverycatalog的数据库
创建表空间:
SQL> create tablespace rmantbs datafile '/u01/app/oracle/oradata/orcl/rmantbs01.dbf' size 50M;
Tablespace created.
创建用户及赋权:
SQL> grant connect,resource,recovery_catalog_owner to rmanct identified by rmanct;
Grant succeeded.
SQL> alter user rmanct default tablespace rmantbs;
User altered.
2)需要rman备份数据库
修改:$ORACLE_HOME/network/admin/tnsnames.ora,以便访问recovery catalog数据库
[oracle@localhost admin]$ vi tnsnames.ora
CATALOGDB=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.103.109)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
最好还修改一下$ORACLE_HOME/network/admin/listener.or文件,静态注册监听,防止nomount状态连接不上catalog数据库(可参考附2),添加内容如下:
[oracle@localhost admin]$ vi listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
连接到catalog 数据库
[oracle@localhost ~]$ rman catalog rmanct/rmanct@catalogdb
创建catalog
RMAN> create catalog tablespace rmantbs;
将目标数据库的信息注册到catalog
[oracle@localhost ~]$ rman targetsys/sys@orcl catalog rmanct/rmanct@catalogdb
RMAN> register database;
RMAN> resync catalog;
测试备份数据文件
RMAN> backup datafile 1;
6、rman恢复
1)丢失数据文件的恢复
创建测试的数据文件:
SQL> create tablespace test_tbsdatafile '/u01/app/oracle/oradata/orcl/tbs_test01.dbf' size 10M;
Tablespace created.
做一个全库备份:
RMAN> backup database;
关闭数据库
SQL> shutdown immediate
物理的删除刚才创建的数据文件
[oracle@localhost orcl]$ rm tbs_test01.dbf
启动数据库,报错没有找到/u01/app/oracle/oradata/orcl/tbs_test01.dbf 数据文件
SQL> startup
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2253784 bytes
Variable Size 973081640 bytes
Database Buffers 671088640 bytes
Redo Buffers 7094272 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 6 - see DBWR tracefile
ORA-01110: data file 6:'/u01/app/oracle/oradata/orcl/tbs_test01.dbf'
恢复数据文件
RMAN> restore datafile '/u01/app/oracle/oradata/orcl/tbs_test01.dbf';
修复数据文件
RMAN> recover datafile'/u01/app/oracle/oradata/orcl/tbs_test01.dbf';
可以打开数据库
SQL> alter database open;
Database altered.
2)丢失控制文件的恢复
做一个全库备份:
RMAN> backup database;
注:前提是开启了”自动备份控制文件”:CONFIGURE CONTROLFILE AUTOBACKUP ON;
查看控制文件目录:
SQL> show parameter control_files;
NAME TYPE VALUE
------------------- ----------------- -------------
control_files string /u01/app/oracle/oradata/orcl/control01.ctl,
/u01/app/oracle/fast_recovery_area/orcl/control02.ctl
关闭数据库
SQL> shutdown immediate
物理的删除这两个控制文件
[oracle@localhost orcl]$ rm/u01/app/oracle/oradata/orcl/control01.ctl
[oracle@localhost orcl]$ rm/u01/app/oracle/fast_recovery_area/orcl/control02.ctl
启动数据库,报错没有找到控制文件
SQL > startup
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2253784 bytes
Variable Size 956304424 bytes
Database Buffers 687865856 bytes
Redo Buffers 7094272 bytes
ORA-00205: error in identifying control file, check alert logfor more info
从自动备份中恢复控制文件
RMAN> restore controlfile from autobackup;
Starting restore at 26-NOV-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 devicetype=DISK
recovery area destination:/u01/app/oracle/fast_recovery_area
database name (or database unique name)used for search: ORCL
channel ORA_DISK_1: AUTOBACKUP/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_11_26/o1_mf_s_896800491_c5fdcd10_.bkpfound in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUPon day: 20151126
channel ORA_DISK_1: restoring control filefrom AUTOBACKUP/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_11_26/o1_mf_s_896800491_c5fdcd10_.bkp
channel ORA_DISK_1: control file restorefrom AUTOBACKUP complete
output filename=/u01/app/oracle/oradata/orcl/control01.ctl
output filename=/u01/app/oracle/fast_recovery_area/orcl/control02.ctl
Finished restore at 26-NOV-15
mount数据库
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
修复数据库
RMAN> recover database;
Starting recover at 26-NOV-15
Starting implicit crosscheck backup at26-NOV-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 devicetype=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at26-NOV-15
Starting implicit crosscheck copy at26-NOV-15
using channel ORA_DISK_1
Finished implicit crosscheck copy at26-NOV-15
searching for all files in the recoveryarea
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name:/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_11_26/o1_mf_s_896800491_c5fdcd10_.bkp
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 61is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log
archived log filename=/u01/app/oracle/oradata/orcl/redo01.log thread=1 sequence=61
media recovery complete, elapsed time:00:00:01
Finished recover at 26-NOV-15
以resetlogs打开数据库:
RMAN> alter database open resetlogs;
database opened
new incarnation of database registered inrecovery catalog
starting full resync of recovery catalog
full resync complete
3)丢失参数文件的恢复
做一个全库备份:
RMAN> backup database;
查看一下参数文件的位置:
SQL> show parameter spfile;
NAME TYPE VALUE
--------------- --------------------------------------------------------------
spfile string /u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora
关闭数据库
SQL> shutdown immediate
物理的删除参数文件
[oracle@localhost ~]$ rm /u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora
启动数据库,报错没有找到参数文件
SQL> startup
ORA-01078: failure in processing systemparameters
LRM-00109: could not open parameter file'/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'
创建pfile,要启动到nomount状态才能恢复
[oracle@localhost recovery_mk]$ pwd
/u01/app/oracle/recovery_mk
[oracle@localhost orcl]$ vi initorcl.ora
db_name = orcl
control_files=(/u01/app/oracle/oradata/orcl/control01.ctl,/u01/app/oracle/fast_recovery_area/orcl/control02.ctl)
启动到nomount状态:
SQL> startup nomount pfile='/u01/app/oracle/recovery_mk/initorcl.ora'
ORACLE instance started.
Total System Global Area 263090176 bytes
Fixed Size 2252256 bytes
Variable Size 205521440 bytes
Database Buffers 50331648 bytes
Redo Buffers 4984832 bytes
查看spfile的备份情况:
RMAN> list backup of spfile;
List of Backup Sets
===================
BS Key Type LV Size Device TypeElapsed Time Completion Time
------- ---- -- ---------- ----------------------- ---------------
1030 Full 9.36M DISK 00:00:00 26-NOV-15
BP Key: 1031 Status:AVAILABLE Compressed: NO Tag: TAG20151126T163801
Piece Name:/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_11_26/o1_mf_s_896805481_c5fk79ho_.bkp
SPFILE Included: Modification time: 26-NOV-15
SPFILE db_unique_name: ORCL
恢复spfile:
RMAN> restore spfile from '/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_11_26/o1_mf_s_896805481_c5fk79ho_.bkp';
Starting restore at 27-NOV-15
using channel ORA_DISK_1
channel ORA_DISK_1: restoring spfile fromAUTOBACKUP/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_11_26/o1_mf_s_896805481_c5fk79ho_.bkp
channel ORA_DISK_1: SPFILE restore fromAUTOBACKUP complete
Finished restore at 27-NOV-15
这时候生成了参数文件,查看一下:
[oracle@localhost dbs]$ ll spfile*
-rw-r----- 1 oracle oinstall 2560 Nov 2714:43 spfileorcl.ora
重启数据库就可以了:
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2253784 bytes
Variable Size 956304424 bytes
Database Buffers 687865856 bytes
Redo Buffers 7094272 bytes
Database mounted.
Database opened.
附1:ORA-19806错误,不能复合备份
设置了复合备份
RMAN> configure datafile backup copiesfor device type disk to 2;
RMAN> configure archivelog backup copiesfor device type disk to 2;
执行备份数据库,发现有错误提示,不能复合备份
RMAN> backup database;
Starting backup at 25-NOV-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafilebackup set
channel ORA_DISK_1: specifying datafile(s)in backup set
input datafile file number=00001name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at25-NOV-15
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGESTACK FOLLOWS ===============
RMAN-00571:===========================================================
RMAN-03009: failure of backup command onORA_DISK_1 channel at 11/25/2015 08:48:04
ORA-19806: cannot make duplex backups in recovery area
解决方案:设置备份格式,加%U 表示不重复命名
RMAN> backup database format '/u01/app/oracle/bak_%U';
附2:ORA-12528错误,在nomount状态无法连接到catalog数据库
当在nomount状态是,连接catalog数据库报错如下:
[oracle@localhost ~]$ rman target sys/sys@orcl catalog rmanct/rmanct@catalogdb
Recovery Manager: Release 11.2.0.4.0 -Production on Thu Nov 26 15:29:53 2015
Copyright (c) 1982, 2011, Oracle and/or itsaffiliates. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGESTACK FOLLOWS ===============
RMAN-00571:===========================================================
RMAN-00554: initialization of internalrecovery manager package failed
RMAN-04005: error from target database:
ORA-12528: TNS:listener: all appropriate instances areblocking new connections
解决方案:把listener.ora动态注册设置为静态注册(添加红色部分),之后需要重启监听
[oracle@localhost admin]$ vi listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME =ORCL)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
重启监听
[oracle@localhost orcl]$ lsnrctl stop
[oracle@localhost orcl]$ lsnrctl start