Bo's Oracle Station

查看: 2371|回复: 0

课程第17/18次(2018-07-22星期日上下午)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2018-7-22 09:33:26 | 显示全部楼层 |阅读模式
set newname for指导restore和 duplicate,set newname之后如果跟着switch,就是为了把restore出来的镜像拷贝变为数据文件,switch实际上就是alter database rename file '' to '':
  1. run{
  2. set newname for datafile 5 to '/home/oracle/examplettio.dbf';
  3. restore datafile 5;
  4. delete datafilecopy '/home/oracle/examplettio.dbf';
  5. }
复制代码

set newname语法可以在克隆时与 set db_file_name_convert/set log_file_name_convert互相替换。

关于克隆的backup location的语法:
1. 在源头数据库上做:
  1. --源头把备份优化关掉,或用force语法

  2. run {
  3. allocate channel  c1 device type disk format '/home/oracle/backup/%U';
  4. allocate channel  c2 device type disk format '/home/oracle/backup/%U';
  5. allocate channel  c3 device type disk format '/home/oracle/backup/%U';
  6. allocate channel  c4 device type disk format '/home/oracle/backup/%U';
  7. allocate channel  c5 device type disk format '/home/oracle/backup/%U';
  8. allocate channel  c6 device type disk format '/home/oracle/backup/%U';
  9. allocate channel  c7 device type disk format '/home/oracle/backup/%U';
  10. allocate channel  c8 device type disk format '/home/oracle/backup/%U';
  11. backup database plus archivelog force;
  12. backup spfile;
  13. backup current controlfile;
  14. }
复制代码
把源头库上的/home/oracle/backup/完整scp -rp 到目的地机器相同的位置:
在目的机器上写一个只有一行或两行的init.ora:db_name=...  db_domain=...
db_name和db_doamin必须在目的地机器上做静态注册。
开启克隆命令:
  1. run{
  2. duplicate target database to mydb
  3. backup location '/home/oracle/backup'
  4. nofilenamecheck
  5. skip tablespace  'TBS1','TBS2'
  6. spfile
  7. set
  8. control_files='/u01/app/oracle/oradata/mydb/control01.ctl','/u01/app/oracle/oradata/mydb/control02.ctl','/u01/app/oracle/oradata/mydb/control03.ctl'
  9. set
  10. db_file_name_convert='+DATA/orcl/datafile/example.258.880451611','/u01/app/oracle/oradata/mydb/example01.dbf','+DATA/orcl/datafile/users.259.880451615','/u01/app/oracle/oradata/mydb/users01.dbf','+DATA/orcl/datafile/undotbs1.256.880451607','/u01/app/oracle/oradata/mydb/undotbs01.dbf','+DATA/orcl/datafile/sysaux.257.880451605','/u01/app/oracle/oradata/mydb/sysaux01.dbf','+DATA/orcl/datafile/system.265.880451605','/u01/app/oracle/oradata/mydb/system01.dbf'
  11. set
  12. log_file_name_convert='+DATA/orcl/onlinelog/group_1.270.880453135','/u01/app/oracle/oradata/mydb/redo01a.log','+FRA/orcl/onlinelog/group_1.276.880453137','/u01/app/oracle/oradata/mydb/redo01b.log','+DATA/orcl/onlinelog/group_3.272.880453141','/u01/app/oracle/oradata/mydb/redo03a.log','+FRA/orcl/onlinelog/group_3.274.880453141','/u01/app/oracle/oradata/mydb/redo03b.log','+DATA/orcl/onlinelog/group_2.271.880453137','/u01/app/oracle/oradata/mydb/redo02a.log','+FRA/orcl/onlinelog/group_2.275.880453139','/u01/app/oracle/oradata/mydb/redo02b.log'
  13. set
  14. audit_file_dest='/u01/app/oracle/admin/mydb/adump'
  15. set
  16. db_create_file_dest=''
  17. set
  18. db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
  19. }
复制代码
如果做dataguard的主备库的口令文件一定要写ignorecase=y
主库改了4个对应的参数:
  1. SQL> alter system set log_archive_config='dg_config=(PROD1,STDBY)';

  2. System altered.

  3. SQL> alter system set log_archive_dest_1='location=use_db_recovery_file_dest';

  4. System altered.


  5. SQL> alter system set log_archive_dest_2='service=STDBY  valid_for=(online_logfiles, primary_role) db_unique_name=STDBY';

  6. System altered.

  7. SQL> show parameter standby

  8. NAME                                     TYPE         VALUE
  9. ------------------------------------ ----------- ------------------------------
  10. standby_archive_dest                     string         ?/dbs/arch
  11. standby_file_management              string         MANUAL
  12. SQL> alter system set standby_file_management=auto;

  13. System altered.
复制代码
  1. SQL> conn / as sysdba
  2. Connected.
  3. SQL> alter database enable force logging;
复制代码

备库的克隆脚本:
  1. run{
  2. duplicate target database
  3. for standby
  4. from active database
  5. nofilenamecheck
  6. spfile
  7. set
  8. control_files='/u01/app/oracle/oradata/STDBY/control01.ctl','/u01/app/oracle/fast_recovery_area/STDBY/control02.ctl'
  9. set
  10. db_file_name_convert='/u01/app/oracle/oradata/PROD1','/u01/app/oracle/oradata/STDBY'
  11. set
  12. log_file_name_convert='/u01/app/oracle/oradata/PROD1','/u01/app/oracle/oradata/STDBY'
  13. set
  14. audit_file_dest='/u01/app/oracle/admin/STDBY/adump'
  15. set
  16. log_archive_dest_2='service=PROD1  valid_for=(online_logfiles, primary_role) db_unique_name=PROD1'
  17. set
  18. db_unique_name='STDBY';
  19. }
复制代码
备库RMAN命令:
  1. rman target sys/oracle_4U@PROD1 auxiliary sys/oracle_4U@STDBY cmdfile=STDBY.rcv
复制代码

在备库上执行以下命令:
  1. SQL> alter database  recover managed standby database disconnect from session;
复制代码

关掉日志应用的命令:
  1. SQL> alter database  recover managed standby database  cancel ;

  2. Database altered.

  3. SQL> !ps aux | grep mrp
  4. oracle   18755  0.0  0.0   4732   996 pts/2    S+   02:41   0:00 /bin/bash -c ps aux | grep mrp
  5. oracle   18757  0.0  0.0   4124   628 pts/2    S+   02:41   0:00 grep mrp

  6. SQL>
复制代码
ADG化:


  1. SQL> alter database open read only;

  2. Database altered.

  3. SQL> alter database  recover managed standby database disconnect from session;

  4. Database altered.

  5. SQL>
复制代码
Dmon进程两边打开:
  1. [oracle@station37 ~]$ sqlplus /nolog

  2. SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 22 05:58:43 2018

  3. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  4. SQL> conn / as sysdba
  5. Connected.
  6. SQL> show parameter dg

  7. NAME                                     TYPE         VALUE
  8. ------------------------------------ ----------- ------------------------------
  9. dg_broker_config_file1                     string         /u01/app/oracle/product/11.2.0
  10.                                                  /dbhome_1/dbs/dr1PROD1.dat
  11. dg_broker_config_file2                     string         /u01/app/oracle/product/11.2.0
  12.                                                  /dbhome_1/dbs/dr2PROD1.dat
  13. dg_broker_start                      boolean         FALSE
  14. SQL> !ps aux | grep dmon
  15. oracle   27892  0.0  0.0   4732  1000 pts/1    S+   05:59   0:00 /bin/bash -c ps aux | grep dmon
  16. oracle   27894  0.0  0.0   4124   620 pts/1    S+   05:59   0:00 grep dmon

  17. SQL> alter system set dg_broker_start=true;

  18. System altered.

  19. SQL> !ps aux | grep dmon
  20. oracle   27897  0.1  0.1 696232 14600 ?        Ss   05:59   0:00 ora_dmon_PROD1
  21. oracle   27898  0.0  0.0   4732  1000 pts/1    S+   05:59   0:00 /bin/bash -c ps aux | grep dmon
  22. oracle   27900  0.0  0.0   4124   640 pts/1    S+   05:59   0:00 grep dmon

复制代码
  1. SQL>  show parameter dg

  2. NAME                                     TYPE         VALUE
  3. ------------------------------------ ----------- ------------------------------
  4. dg_broker_config_file1                     string         /u01/app/oracle/product/11.2.0
  5.                                                  /dbhome_1/dbs/dr1STDBY.dat
  6. dg_broker_config_file2                     string         /u01/app/oracle/product/11.2.0
  7.                                                  /dbhome_1/dbs/dr2STDBY.dat
  8. dg_broker_start                      boolean         FALSE
  9. SQL> !ps aux | grep dmon
  10. oracle   22939  0.0  0.0   4732  1000 pts/2    S+   05:59   0:00 /bin/bash -c ps aux | grep dmon
  11. oracle   22941  0.0  0.0   4124   632 pts/2    S+   05:59   0:00 grep dmon

  12. SQL> alter system set dg_broker_start=true;

  13. System altered.

  14. SQL> !ps aux | grep dmon
  15. oracle   22955  0.3  0.1 696232 14512 ?        Ss   05:59   0:00 ora_dmon_STDBY
  16. oracle   22956  0.0  0.0   4732  1000 pts/2    S+   05:59   0:00 /bin/bash -c ps aux | grep dmon
  17. oracle   22958  0.0  0.0   4124   636 pts/2    S+   05:59   0:00 grep dmon

  18. SQL>
复制代码

Dataguard构造:
  1. [oracle@station37 ~]$ dgmgrl
  2. DGMGRL for Linux: Version 11.2.0.3.0 - Production

  3. Copyright (c) 2000, 2009, Oracle. All rights reserved.

  4. Welcome to DGMGRL, type "help" for information.
  5. DGMGRL> connect sys/oracle_4U@PROD1
  6. Connected.
  7. DGMGRL> help

  8. The following commands are available:

  9. add            Adds a standby database to the broker configuration
  10. connect        Connects to an Oracle database instance
  11. convert        Converts a database from one type to another
  12. create         Creates a broker configuration
  13. disable        Disables a configuration, a database, or fast-start failover
  14. edit           Edits a configuration, database, or instance
  15. enable         Enables a configuration, a database, or fast-start failover
  16. exit           Exits the program
  17. failover       Changes a standby database to be the primary database
  18. help           Displays description and syntax for a command
  19. quit           Exits the program
  20. reinstate      Changes a database marked for reinstatement into a viable standby
  21. rem            Comment to be ignored by DGMGRL
  22. remove         Removes a configuration, database, or instance
  23. show           Displays information about a configuration, database, or instance
  24. shutdown       Shuts down a currently running Oracle database instance
  25. sql            Executes a SQL statement
  26. start          Starts the fast-start failover observer
  27. startup        Starts an Oracle database instance
  28. stop           Stops the fast-start failover observer
  29. switchover     Switches roles between a primary and standby database

  30. Use "help <command>" to see syntax for individual commands
复制代码
----------------------------------------

  1. [oracle@station37 ~]$ dgmgrl
  2. DGMGRL for Linux: Version 11.2.0.3.0 - Production

  3. Copyright (c) 2000, 2009, Oracle. All rights reserved.

  4. Welcome to DGMGRL, type "help" for information.
  5. DGMGRL> connect sys/oracle_4U@PROD1
  6. Connected.
  7. DGMGRL> help create

  8. Creates a broker configuration

  9. Syntax:

  10.   CREATE CONFIGURATION <configuration name> AS
  11.     PRIMARY DATABASE IS <database name>
  12.     CONNECT IDENTIFIER IS <connect identifier>;

  13. DGMGRL> CREATE CONFIGURATION PROD1  as
  14. >  PRIMARY DATABASE IS  'PROD1'
  15. > CONNECT IDENTIFIER IS PROD1;
  16. Configuration "prod1" created with primary database "PROD1"
  17. DGMGRL> help add

  18. Adds a standby database to the broker configuration

  19. Syntax:

  20.   ADD DATABASE <database name>
  21.     [AS CONNECT IDENTIFIER IS <connect identifier>]
  22.     [MAINTAINED AS {PHYSICAL|LOGICAL}];

  23. DGMGRL>  ADD DATABASE 'STDBY'
  24. > AS CONNECT IDENTIFIER IS STDBY
  25. >  MAINTAINED AS  PHYSICAL;
  26. Database "STDBY" added
  27. DGMGRL> enable configuration;
  28. Enabled.
  29. DGMGRL> show configuration verbose;

  30. Configuration - prod1

  31.   Protection Mode: MaxPerformance
  32.   Databases:
  33.     PROD1 - Primary database
  34.     STDBY - Physical standby database

  35.   Properties:
  36.     FastStartFailoverThreshold      = '30'
  37.     OperationTimeout                = '30'
  38.     FastStartFailoverLagLimit       = '30'
  39.     CommunicationTimeout            = '180'
  40.     FastStartFailoverAutoReinstate  = 'TRUE'
  41.     FastStartFailoverPmyShutdown    = 'TRUE'
  42.     BystandersFollowRoleChange      = 'ALL'

  43. Fast-Start Failover: DISABLED

  44. Configuration Status:
  45. SUCCESS

  46. DGMGRL> DGMGRL> [oracle@station37 ~]$
复制代码
  1. DGMGRL> show database verbose'PROD1';

  2. Database - PROD1

  3.   Role:            PRIMARY
  4.   Intended State:  TRANSPORT-ON
  5.   Instance(s):
  6.     PROD1

  7.   Properties:
  8.     DGConnectIdentifier             = 'prod1'
  9.     ObserverConnectIdentifier       = ''
  10.     LogXptMode                      = 'ASYNC'
  11.     DelayMins                       = '0'
  12.     Binding                         = 'optional'
  13.     MaxFailure                      = '0'
  14.     MaxConnections                  = '1'
  15.     ReopenSecs                      = '300'
  16.     NetTimeout                      = '30'
  17.     RedoCompression                 = 'DISABLE'
  18.     LogShipping                     = 'ON'
  19.     PreferredApplyInstance          = ''
  20.     ApplyInstanceTimeout            = '0'
  21.     ApplyParallel                   = 'AUTO'
  22.     StandbyFileManagement           = 'AUTO'
  23.     ArchiveLagTarget                = '0'
  24.     LogArchiveMaxProcesses          = '4'
  25.     LogArchiveMinSucceedDest        = '1'
  26.     DbFileNameConvert               = ''
  27.     LogFileNameConvert              = ''
  28.     FastStartFailoverTarget         = ''
  29.     InconsistentProperties          = '(monitor)'
  30.     InconsistentLogXptProps         = '(monitor)'
  31.     SendQEntries                    = '(monitor)'
  32.     LogXptStatus                    = '(monitor)'
  33.     RecvQEntries                    = '(monitor)'
  34.     SidName                         = 'PROD1'
  35.     StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=station37.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PROD1_DGMGRL)(INSTANCE_NAME=PROD1)(SERVER=DEDICATED)))'
  36.     StandbyArchiveLocation          = 'USE_DB_RECOVERY_FILE_DEST'
  37.     AlternateLocation               = ''
  38.     LogArchiveTrace                 = '0'
  39.     LogArchiveFormat                = '%t_%s_%r.dbf'
  40.     TopWaitEvents                   = '(monitor)'

  41. Database Status:
  42. SUCCESS

  43. DGMGRL> show database verbose 'STDBY';

  44. Database - STDBY

  45.   Role:            PHYSICAL STANDBY
  46.   Intended State:  APPLY-ON
  47.   Transport Lag:   0 seconds
  48.   Apply Lag:       0 seconds
  49.   Real Time Query: ON
  50.   Instance(s):
  51.     STDBY

  52.   Properties:
  53.     DGConnectIdentifier             = 'stdby'
  54.     ObserverConnectIdentifier       = ''
  55.     LogXptMode                      = 'ASYNC'
  56.     DelayMins                       = '0'
  57.     Binding                         = 'OPTIONAL'
  58.     MaxFailure                      = '0'
  59.     MaxConnections                  = '1'
  60.     ReopenSecs                      = '300'
  61.     NetTimeout                      = '30'
  62.     RedoCompression                 = 'DISABLE'
  63.     LogShipping                     = 'ON'
  64.     PreferredApplyInstance          = ''
  65.     ApplyInstanceTimeout            = '0'
  66.     ApplyParallel                   = 'AUTO'
  67.     StandbyFileManagement           = 'AUTO'
  68.     ArchiveLagTarget                = '0'
  69.     LogArchiveMaxProcesses          = '4'
  70.     LogArchiveMinSucceedDest        = '1'
  71.     DbFileNameConvert               = '/u01/app/oracle/oradata/PROD1, /u01/app/oracle/oradata/STDBY'
  72.     LogFileNameConvert              = '/u01/app/oracle/oradata/PROD1, /u01/app/oracle/oradata/STDBY'
  73.     FastStartFailoverTarget         = ''
  74.     InconsistentProperties          = '(monitor)'
  75.     InconsistentLogXptProps         = '(monitor)'
  76.     SendQEntries                    = '(monitor)'
  77.     LogXptStatus                    = '(monitor)'
  78.     RecvQEntries                    = '(monitor)'
  79.     SidName                         = 'STDBY'
  80.     StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=station38.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=STDBY_DGMGRL)(INSTANCE_NAME=STDBY)(SERVER=DEDICATED)))'
  81.     StandbyArchiveLocation          = 'USE_DB_RECOVERY_FILE_DEST'
  82.     AlternateLocation               = ''
  83.     LogArchiveTrace                 = '0'
  84.     LogArchiveFormat                = '%t_%s_%r.dbf'
  85.     TopWaitEvents                   = '(monitor)'

  86. Database Status:
  87. SUCCESS

  88. DGMGRL>
复制代码

如果改保护模式时,报告:
  1. DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability;
  2. Error: ORA-16627: operation disallowed since no standby databases would remain to support protection mode

  3. Failed.
  4. DGMGRL>
复制代码
说明没有改LOGXPTMODE:
备库的broker属性是主库的参数文件参数;主库的broker属性是备库的参数文件参数:
aa.png

两头改闪回,并且打开Real Time Apply:
  1. SQL> select  flashback_on from v$database;

  2. FLASHBACK_ON
  3. ------------------
  4. NO

  5. SQL> alter database flashback on ;
  6. alter database flashback on
  7. *
  8. ERROR at line 1:
  9. ORA-01153: an incompatible media recovery is active


  10. SQL> alter database recover managed standby database cancel ;

  11. Database altered.

  12. SQL> alter database flashback on ;

  13. Database altered.

  14. SQL> alter database recover managed standby database using current logfile disconnect;

  15. Database altered.

  16. SQL>
复制代码
快照物理备库,实际上就是过去1. 手工创建保障闪回还原点;2.激活物理备库。

  1. DGMGRL>  CONVERT DATABASE 'STDBY' to SNAPSHOT STANDBY;
  2. Converting database "STDBY" to a Snapshot Standby database, please wait...
  3. Database "STDBY" converted successfully
复制代码
  1. SQL> select  * from v$restore_point;

  2.        SCN DATABASE_INCARNATION# GUA STORAGE_SIZE TIME                                                                              RESTORE_POINT_TIME                                                          PRE NAME
  3. ---------- --------------------- --- ------------ --------------------------------------------------------------------------- --------------------------------------------------------------------------- --- --------------------------------------------------------------------------------------------------------------------------------
  4.    1002609                       2 YES         52428800 22-JUL-15 06.38.53.000000000 AM                                                          YES SNAPSHOT_STANDBY_REQUIRED_07/22/2015 06:38:53

复制代码
在物理备库上打开块跟踪:
  1. SQL> alter database enable block change tracking using file '/u01/app/oracle/fast_recovery_area/STDBY/ctwr.f';

  2. Database altered.

  3. SQL> !ps aux | grep ora_ctwr
  4. oracle   24736  0.1  0.1 695884 14452 ?        Ss   07:04   0:00 ora_ctwr_STDBY
  5. oracle   24739  0.0  0.0   4732   996 pts/2    S+   07:05   0:00 /bin/bash -c ps aux | grep ora_ctwr
  6. oracle   24741  0.0  0.0   4124   632 pts/2    S+   07:05   0:00 grep ora_ctwr

  7. SQL>
复制代码
下面最后一道题:快速启动故障转移。
----------------------------------------------------------------------------
归档性备份:9i的时候是事后做,而11g同时做:
9i:
  1. RMAN> change backupset 2 keep until  time 'sysdate+60';

  2. allocated channel: ORA_DISK_1
  3. channel ORA_DISK_1: SID=11 device type=DISK
  4. RMAN-00571: ===========================================================
  5. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  6. RMAN-00571: ===========================================================
  7. RMAN-03009: failure of KEEP command on ORA_DISK_1 channel at 07/22/2018 17:03:49
  8. ORA-19811: cannot have files in DB_RECOVERY_FILE_DEST with keep attributes

  9. RMAN> run {
  10. 2> allocate channel c1 device type disk format '/home/oracle/%U';
  11. 3> backup backupset 2 force delete input;
  12. 4> change backupset 2 keep until  time 'sysdate+60';
  13. 5> }

  14. released channel: ORA_DISK_1
  15. allocated channel: c1
  16. channel c1: SID=11 device type=DISK

  17. Starting backup at 22-JUL-18
  18. channel c1: input backup set: count=2, stamp=981994123, piece=1
  19. channel c1: starting piece 1 at 22-JUL-18
  20. channel c1: backup piece +FRA/orcl/backupset/2018_07_20/nnndf0_tag20180720t160842_0.262.981994123
  21. piece handle=/home/oracle/02t8g2kb_1_2 comment=NONE
  22. channel c1: finished piece 1 at 22-JUL-18
  23. channel c1: backup piece complete, elapsed time: 00:00:36
  24. deleted backup piece
  25. backup piece handle=+FRA/orcl/backupset/2018_07_20/nnndf0_tag20180720t160842_0.262.981994123 RECID=2 STAMP=981994123
  26. Finished backup at 22-JUL-18

  27. keep attributes for the backup are changed
  28. backup will be obsolete on date 20-SEP-18
  29. backup set key=2 RECID=2 STAMP=981994142
  30. released channel: c1

复制代码
  1. RMAN> run {
  2. 2> allocate channel c1 device type disk format '/home/oracle/example_%U.bkp';
  3. 3> backup tag 'TAG2'  tablespace example keep until time 'sysdate+600';
  4. 4> }

  5. released channel: ORA_DISK_1
  6. allocated channel: c1
  7. channel c1: SID=11 device type=DISK

  8. Starting backup at 22-JUL-18
  9. current log archived

  10. backup will be obsolete on date 13-MAR-20
  11. archived logs required to recover from this backup will be backed up
  12. channel c1: starting full datafile backup set
  13. channel c1: specifying datafile(s) in backup set
  14. input datafile file number=00005 name=+DATA/orcl/datafile/example.265.979605007
  15. channel c1: starting piece 1 at 22-JUL-18
  16. channel c1: finished piece 1 at 22-JUL-18
  17. piece handle=/home/oracle/example_0at8lefa_1_1.bkp tag=TAG2 comment=NONE
  18. channel c1: backup set complete, elapsed time: 00:00:03

  19. backup will be obsolete on date 13-MAR-20
  20. archived logs required to recover from this backup will be backed up
  21. channel c1: starting full datafile backup set
  22. channel c1: specifying datafile(s) in backup set
  23. including current SPFILE in backup set
  24. channel c1: starting piece 1 at 22-JUL-18
  25. channel c1: finished piece 1 at 22-JUL-18
  26. piece handle=/home/oracle/example_0bt8lefd_1_1.bkp tag=TAG2 comment=NONE
  27. channel c1: backup set complete, elapsed time: 00:00:01

  28. current log archived
  29. backup will be obsolete on date 13-MAR-20
  30. archived logs required to recover from this backup will be backed up
  31. channel c1: starting archived log backup set
  32. channel c1: specifying archived log(s) in backup set
  33. input archived log thread=1 sequence=5 RECID=16 STAMP=982170096
  34. channel c1: starting piece 1 at 22-JUL-18
  35. channel c1: finished piece 1 at 22-JUL-18
  36. piece handle=/home/oracle/example_0ct8lefh_1_1.bkp tag=TAG2 comment=NONE
  37. channel c1: backup set complete, elapsed time: 00:00:01

  38. backup will be obsolete on date 13-MAR-20
  39. archived logs required to recover from this backup will be backed up
  40. channel c1: starting full datafile backup set
  41. channel c1: specifying datafile(s) in backup set
  42. including current control file in backup set
  43. channel c1: starting piece 1 at 22-JUL-18
  44. channel c1: finished piece 1 at 22-JUL-18
  45. piece handle=/home/oracle/example_0dt8lefi_1_1.bkp tag=TAG2 comment=NONE
  46. channel c1: backup set complete, elapsed time: 00:00:01
  47. Finished backup at 22-JUL-18
  48. released channel: c1

  49. RMAN> list backup of tablespace example;


  50. List of Backup Sets
  51. ===================


  52. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  53. ------- ---- -- ---------- ----------- ------------ ---------------
  54. 2       Full    1.03G      DISK        00:00:19     20-JUL-18      
  55.         BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20180720T160842
  56.         Piece Name: +FRA/orcl/backupset/2018_07_20/nnndf0_tag20180720t160842_0.262.981994123
  57.   List of Datafiles in backup set 2
  58.   File LV Type Ckp SCN    Ckp Time  Name
  59.   ---- -- ---- ---------- --------- ----
  60.   5       Full 884504     20-JUL-18 +DATA/orcl/datafile/example.265.979605007

  61. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  62. ------- ---- -- ---------- ----------- ------------ ---------------
  63. 5       Full    69.57M     DISK        00:00:02     22-JUL-18      
  64.         BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG2
  65.         Piece Name: /home/oracle/example_0at8lefa_1_1.bkp
  66.         Keep: BACKUP_LOGS        Until: 13-MAR-20      
  67.   List of Datafiles in backup set 5
  68.   File LV Type Ckp SCN    Ckp Time  Name
  69.   ---- -- ---- ---------- --------- ----
  70.   5       Full 956748     22-JUL-18 +DATA/orcl/datafile/example.265.979605007

  71. RMAN> list backup of archivelog all;


  72. List of Backup Sets
  73. ===================


  74. BS Key  Size       Device Type Elapsed Time Completion Time
  75. ------- ---------- ----------- ------------ ---------------
  76. 7       8.00K      DISK        00:00:00     22-JUL-18      
  77.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG2
  78.         Piece Name: /home/oracle/example_0ct8lefh_1_1.bkp
  79.         Keep: BACKUP_LOGS        Until: 13-MAR-20      

  80.   List of Archived Logs in backup set 7
  81.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  82.   ---- ------- ---------- --------- ---------- ---------
  83.   1    5       956744     22-JUL-18 956761     22-JUL-18
复制代码
  1. RMAN> run {                       
  2. 2> allocate channel c1 device type disk format '/home/oracle/example_%U.bkp';
  3. 3> backup tag 'TAG3' tablespace example keep  forever;
  4. 4> }

  5. allocated channel: c1
  6. channel c1: SID=11 device type=DISK

  7. Starting backup at 22-JUL-18
  8. current log archived

  9. released channel: c1
  10. RMAN-00571: ===========================================================
  11. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  12. RMAN-00571: ===========================================================
  13. RMAN-03002: failure of backup command at 07/22/2018 17:10:07
  14. RMAN-06522: KEEP FOREVER option is not supported without the recovery catalog

复制代码
  1. [oracle@station36 admin]$ rman target /  catalog u36/oracle_4U@rcat

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jul 22 17:14:13 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1507385682)
  5. connected to recovery catalog database

  6. RMAN> run {
  7. 2> allocate channel c1 device type disk format '/home/oracle/example_%U.bkp';
  8. 3> backup tag 'TAG3' tablespace example keep  forever restore point tag3;
  9. 4> }

  10. allocated channel: c1
  11. channel c1: SID=75 device type=DISK

  12. Starting backup at 22-JUL-18
  13. current log archived

  14. backup will never be obsolete
  15. archived logs required to recover from this backup will be backed up
  16. channel c1: starting full datafile backup set
  17. channel c1: specifying datafile(s) in backup set
  18. input datafile file number=00005 name=+DATA/orcl/datafile/example.265.979605007
  19. channel c1: starting piece 1 at 22-JUL-18
  20. channel c1: finished piece 1 at 22-JUL-18
  21. piece handle=/home/oracle/example_0et8lf86_1_1.bkp tag=TAG3 comment=NONE
  22. channel c1: backup set complete, elapsed time: 00:00:01

  23. backup will never be obsolete
  24. archived logs required to recover from this backup will be backed up
  25. channel c1: starting full datafile backup set
  26. channel c1: specifying datafile(s) in backup set
  27. including current SPFILE in backup set
  28. channel c1: starting piece 1 at 22-JUL-18
  29. channel c1: finished piece 1 at 22-JUL-18
  30. piece handle=/home/oracle/example_0ft8lf87_1_1.bkp tag=TAG3 comment=NONE
  31. channel c1: backup set complete, elapsed time: 00:00:01


  32. current log archived
  33. backup will never be obsolete
  34. archived logs required to recover from this backup will be backed up
  35. channel c1: starting archived log backup set
  36. channel c1: specifying archived log(s) in backup set
  37. input archived log thread=1 sequence=8 RECID=19 STAMP=982170890
  38. channel c1: starting piece 1 at 22-JUL-18
  39. channel c1: finished piece 1 at 22-JUL-18
  40. piece handle=/home/oracle/example_0gt8lf8b_1_1.bkp tag=TAG3 comment=NONE
  41. channel c1: backup set complete, elapsed time: 00:00:01

  42. backup will never be obsolete
  43. archived logs required to recover from this backup will be backed up
  44. channel c1: starting full datafile backup set
  45. channel c1: specifying datafile(s) in backup set
  46. including current control file in backup set
  47. channel c1: starting piece 1 at 22-JUL-18
  48. channel c1: finished piece 1 at 22-JUL-18
  49. piece handle=/home/oracle/example_0ht8lf8c_1_1.bkp tag=TAG3 comment=NONE
  50. channel c1: backup set complete, elapsed time: 00:00:01
  51. Finished backup at 22-JUL-18
  52. released channel: c1

  53. RMAN>
复制代码
  1. [oracle@station36 admin]$ sqlplus /nolog

  2. SQL*Plus: Release 11.2.0.1.0 Production on Sun Jul 22 17:15:22 2018

  3. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  4. SQL> conn / as sysdba
  5. Connected.
  6. SQL> set linesize 1000
  7. SQL> select  * from v$restore_point;

  8.        SCN DATABASE_INCARNATION# GUA STORAGE_SIZE TIME                                                                              RESTORE_POINT_TIME                                                          PRE NAME
  9. ---------- --------------------- --- ------------ --------------------------------------------------------------------------- --------------------------------------------------------------------------- --- --------------------------------------------------------------------------------------------------------------------------------
  10.     958398                       4 NO                0 22-JUL-18 05.14.48.000000000 PM                                                          NO  TAG3

  11. SQL>
复制代码

如果agent死活上传失败,考虑在EMREP上执行:
  1. execute mgmt_admin.cleanup_agent('station37.example.com:3872');
复制代码
再装-b -y
a.png














回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-3-29 23:39 , Processed in 0.043522 second(s), 27 queries .

快速回复 返回顶部 返回列表