Bo's Oracle Station

查看: 2291|回复: 0

课程第32/33次(2017-05-20星期六上下午)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2017-5-22 10:35:16 | 显示全部楼层 |阅读模式
上完1Z0-053第7章
开始1Z0-053第20章克隆数据库(auxiliary channel)
1Z0-0
52共19章(上完12章),1Z0-053共21章(上完11章)和1Z0-063多租户部分共9章(上完0章)
总共上完全部49章中的23章

  1. select  * from v$log;

  2. select  * from v$datafile;

  3. select  * from v$controlfile;

  4. select  * from v$tempfile;

  5. alter database drop logfile group 1;

  6. alter database add logfile group 1 size 100M;


  7. alter database drop logfile group 3;
  8. alter database add logfile group 3 size 100M;

  9. alter system switch logfile
  10. alter system checkpoint




  11. RMAN> run {
  12. 2> set newname for database to '+DATA';
  13. 3> restore database;
  14. 4> switch datafile all;
  15. 5> }
复制代码

asm2filesystem.rcv:
  1. run {
  2. allocate channel c1 device type disk  format '/u01/app/oracle/oradata/orcl/system01.dbf';
  3. backup as copy datafile '+DATA/ORCL/DATAFILE/SYSTEM.256.816169553';
  4. release channel c1;
  5. allocate channel c2 device type disk  format '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
  6. backup as copy datafile '+DATA/ORCL/DATAFILE/SYSAUX.257.816169553';
  7. release channel c2;
  8. allocate channel c3 device type disk  format '/u01/app/oracle/oradata/orcl/undotbs1.dbf';
  9. backup as copy datafile '+DATA/ORCL/DATAFILE/UNDOTBS1.258.816169553';
  10. release channel c3;
  11. allocate channel c4 device type disk  format '/u01/app/oracle/oradata/orcl/users01.dbf';
  12. backup as copy datafile '+DATA/ORCL/DATAFILE/USERS.259.816169553';
  13. release channel c4;
  14. allocate channel c5 device type disk  format '/u01/app/oracle/oradata/orcl/example01.dbf';
  15. backup as copy datafile '+DATA/ORCL/DATAFILE/EXAMPLE.265.816169651';
  16. release channel c5;
  17. }
复制代码

control8b.sql:
  1. CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  ARCHIVELOG
  2.     MAXLOGFILES 16
  3.     MAXLOGMEMBERS 3
  4.     MAXDATAFILES 100
  5.     MAXINSTANCES 8
  6.     MAXLOGHISTORY 292
  7. LOGFILE
  8.   GROUP 1 (
  9.     '+DATA/orcl/onlinelog/group_1.261.816169635',
  10.     '+FRA/orcl/onlinelog/group_1.257.816169637'
  11.   ) SIZE 50M BLOCKSIZE 512,
  12.   GROUP 2 (
  13.     '+DATA/orcl/onlinelog/group_2.262.816169639',
  14.     '+FRA/orcl/onlinelog/group_2.258.816169639'
  15.   ) SIZE 50M BLOCKSIZE 512,
  16.   GROUP 3 (
  17.     '+DATA/orcl/onlinelog/group_3.263.816169641',
  18.     '+FRA/orcl/onlinelog/group_3.259.816169641'
  19.   ) SIZE 50M BLOCKSIZE 512
  20. DATAFILE
  21.   '+DATA/orcl/datafile/SYSTEM.256.816169553',
  22.   '+DATA/orcl/datafile/SYSAUX.257.816169553',
  23.   '+DATA/orcl/datafile/UNDOTBS1.258.816169553',
  24.   '+DATA/orcl/datafile/EXAMPLE.265.816169651'
  25. CHARACTER SET AL32UTF8
  26. ;

  27. -- Configure RMAN configuration record 1
  28. VARIABLE RECNO NUMBER;
  29. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO RECOVERY WINDOW OF 1 DAYS');
  30. -- Configure RMAN configuration record 2
  31. VARIABLE RECNO NUMBER;
  32. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('BACKUP OPTIMIZATION','ON');
  33. -- Configure RMAN configuration record 3
  34. VARIABLE RECNO NUMBER;
  35. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
  36. -- Configure RMAN configuration record 4
  37. VARIABLE RECNO NUMBER;
  38. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET');
  39. -- Configure RMAN configuration record 5
  40. VARIABLE RECNO NUMBER;
  41. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEFAULT DEVICE TYPE TO','''SBT_TAPE''');
  42. -- Configure RMAN configuration record 6
  43. VARIABLE RECNO NUMBER;
  44. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','1 DEVICE TYPE ''SBT_TAPE'' PARMS  ''ENV=(OB_MEDIA_FAMILY=station2)''');
  45. -- Configure RMAN configuration record 7
  46. VARIABLE RECNO NUMBER;
  47. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','2 DEVICE TYPE ''SBT_TAPE'' PARMS  ''ENV=(OB_MEDIA_FAMILY=station2)''');
  48. -- Configure RMAN configuration record 8
  49. VARIABLE RECNO NUMBER;
  50. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','''SBT_TAPE'' PARALLELISM 2 BACKUP TYPE TO BACKUPSET');
  51. -- Configure RMAN configuration record 9
  52. VARIABLE RECNO NUMBER;
  53. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DATAFILE BACKUP COPIES FOR DEVICE TYPE','''SBT_TAPE'' TO 1');
  54. -- Configure RMAN configuration record 10
  55. VARIABLE RECNO NUMBER;
  56. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('ENCRYPTION FOR DATABASE','ON');
  57. -- Configure RMAN configuration record 11
  58. VARIABLE RECNO NUMBER;
  59. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('COMPRESSION ALGORITHM','''LOW'' AS OF RELEASE ''DEFAULT'' OPTIMIZE FOR LOAD TRUE');
复制代码

control8c.sql:
  1. CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  ARCHIVELOG
  2.     MAXLOGFILES 16
  3.     MAXLOGMEMBERS 3
  4.     MAXDATAFILES 100
  5.     MAXINSTANCES 8
  6.     MAXLOGHISTORY 292
  7. LOGFILE
  8.   GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log'  SIZE 100M BLOCKSIZE 512,
  9.   GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log'  SIZE 100M BLOCKSIZE 512,
  10.   GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log'  SIZE 100M BLOCKSIZE 512
  11. DATAFILE
  12.   '/u01/app/oracle/oradata/orcl/system01.dbf',
  13.   '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
  14.   '/u01/app/oracle/oradata/orcl/undotbs1.dbf',
  15.   '/u01/app/oracle/oradata/orcl/users01.dbf',
  16.   '/u01/app/oracle/oradata/orcl/example01.dbf'
  17. CHARACTER SET AL32UTF8
  18. ;

  19. -- Configure RMAN configuration record 1
  20. VARIABLE RECNO NUMBER;
  21. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO RECOVERY WINDOW OF 1 DAYS');
  22. -- Configure RMAN configuration record 2
  23. VARIABLE RECNO NUMBER;
  24. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('BACKUP OPTIMIZATION','ON');
  25. -- Configure RMAN configuration record 3
  26. VARIABLE RECNO NUMBER;
  27. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
  28. -- Configure RMAN configuration record 4
  29. VARIABLE RECNO NUMBER;
  30. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET');
  31. -- Configure RMAN configuration record 5
  32. VARIABLE RECNO NUMBER;
  33. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEFAULT DEVICE TYPE TO','''SBT_TAPE''');
  34. -- Configure RMAN configuration record 6
  35. VARIABLE RECNO NUMBER;
  36. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','1 DEVICE TYPE ''SBT_TAPE'' PARMS  ''ENV=(OB_MEDIA_FAMILY=station90)''');
  37. -- Configure RMAN configuration record 7
  38. VARIABLE RECNO NUMBER;
  39. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','2 DEVICE TYPE ''SBT_TAPE'' PARMS  ''ENV=(OB_MEDIA_FAMILY=station90)''');
  40. -- Configure RMAN configuration record 8
  41. VARIABLE RECNO NUMBER;
  42. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','''SBT_TAPE'' PARALLELISM 2 BACKUP TYPE TO BACKUPSET');
  43. -- Configure RMAN configuration record 9
  44. VARIABLE RECNO NUMBER;
  45. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DATAFILE BACKUP COPIES FOR DEVICE TYPE','''SBT_TAPE'' TO 1');
  46. -- Configure RMAN configuration record 10
  47. VARIABLE RECNO NUMBER;
  48. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('ENCRYPTION FOR DATABASE','OFF');
  49. -- Configure RMAN configuration record 11
  50. VARIABLE RECNO NUMBER;
  51. EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('COMPRESSION ALGORITHM','''LOW'' AS OF RELEASE ''DEFAULT'' OPTIMIZE FOR LOAD TRUE');
  52. -- Commands to re-create incarnation table
  53. -- Below log names MUST be changed to existing filenames on
  54. -- disk. Any one log file from each branch can be used to
  55. -- re-create incarnation records.
  56. -- ALTER DATABASE REGISTER LOGFILE '+FRA';
  57. -- Recovery is required if any of the datafiles are restored backups,
  58. -- or if the last shutdown was not normal or immediate.
  59. RECOVER DATABASE

  60. -- All logs need archiving and a log switch is needed.
  61. ALTER SYSTEM ARCHIVE LOG ALL;

  62. -- Database can now be opened normally.
  63. ALTER DATABASE OPEN;

  64. -- Commands to add tempfiles to temporary tablespaces.
  65. -- Online tempfiles have complete space information.
  66. -- Other tempfiles may require adjustment.
  67. ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' REUSE;
  68. -- End of tempfile additions.
  69. --
复制代码

dbtest.rcv
  1. run {
  2. duplicate target database to dbtest
  3. from active database
  4. nofilenamecheck
  5. spfile
  6. set
  7. control_files='+DATA','+FRA'
  8. set
  9. db_file_name_convert='+DATA/orcl/','+DATA/dbtest'
  10. set
  11. log_file_name_convert='+DATA/orcl','+DATA/dbtest','+FRA/orcl','+FRA/dbtest'
  12. set
  13. audit_file_dest='/u01/app/oracle/admin/dbtest/adump';
  14. }
复制代码

dg11g.rcv:
  1. run{
  2. duplicate target database to db11g
  3. from active database
  4. nofilenamecheck
  5. spfile
  6. set
  7. control_files='/u01/app/oracle/oradata/db11g/control01.ctl','/u01/app/oracle/oradata/db11g/control02.ctl','/u01/app/oracle/oradata/db11g/control03.ctl'
  8. set
  9. db_file_name_convert='+DATA/orcl/datafile/example.265.832197353','/u01/app/oracle/oradata/db11g/example01.dbf','+DATA/orcl/datafile/users.259.832197065','/u01/app/oracle/oradata/db11g/users01.dbf','+DATA/orcl/datafile/undotbs1.258.832197065','/u01/app/oracle/oradata/db11g/undotbs01.dbf','+DATA/orcl/datafile/sysaux.257.832197065','/u01/app/oracle/oradata/db11g/sysaux01.dbf','+DATA/orcl/datafile/system.256.832197063','/u01/app/oracle/oradata/db11g/system01.dbf'
  10. set
  11. log_file_name_convert='+DATA/orcl/onlinelog/group_1.261.832197287','/u01/app/oracle/oradata/db11g/redo01a.log','+FRA/orcl/onlinelog/group_1.257.832197291','/u01/app/oracle/oradata/db11g/redo01b.log','+DATA/orcl/onlinelog/group_3.263.832197301','/u01/app/oracle/oradata/db11g/redo03a.log','+FRA/orcl/onlinelog/group_3.259.832197305','/u01/app/oracle/oradata/db11g/redo03b.log','+DATA/orcl/onlinelog/group_2.262.832197293','/u01/app/oracle/oradata/db11g/redo02a.log','+FRA/orcl/onlinelog/group_2.258.832197299','/u01/app/oracle/oradata/db11g/redo02b.log';
  12. set
  13. audit_file_dest='/u01/app/oracle/admin/db11g/adump'
  14. set
  15. db_create_file_dest=''
  16. set
  17. db_recovery_file_dest='/u01/app/oracle/flash_recovery_area';
  18. }
复制代码



回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-22 11:19 , Processed in 0.042656 second(s), 24 queries .

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