熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

oracle9i中Rman的備份使用點滴

2022-06-13   來源: Oracle 

  rman的簡單使用: catalog的建立全備份保留備份策略刪除過期備份
  
   查看當前數據庫的數據文件
  
  SQL> select name from V$datafile;
  
  NAME
  
  /oracle/oraclei/oradata/testmysiteok/systemdbf
  /oracle/oraclei/oradata/testmysiteok/undotbsdbf
  /oracle/oraclei/oradata/testmysiteok/cwmlitedbf
  /oracle/oraclei/oradata/testmysiteok/drsysdbf
  /oracle/oraclei/oradata/testmysiteok/exampledbf
  /oracle/oraclei/oradata/testmysiteok/indxdbf
  /oracle/oraclei/oradata/testmysiteok/odmdbf
  /oracle/oraclei/oradata/testmysiteok/toolsdbf
  /oracle/oraclei/oradata/testmysiteok/usersdbf
  /oracle/oraclei/oradata/testmysiteok/xdbdbf
  /oracle/oradata/webdb_filedbf
  
  NAME
  
  /oracle/oradata/webdb_filedbf
  /oracle/oradata/webdb_filedbf
  /oracle/oradata/webdb_filedbf
  
   rows selected
  
   建立catalog表空間為back_up
  
  SQL> create tablespace back_up datafile /oracle/oradata/catalogdbf size m;
  
  Tablespace created
  
   建立rman用戶密碼為rmanrman默認的表空間為back_up使用臨時表空間temp
  

  SQL> create user rman identified by rman default tablespace back_up temmporary tablespace temp;
  create user rman identified by rman default tablespace back_up temmporary tablespace temp
                                  *
  ERROR at line :
  ORA: missing or invalid option
  
  SQL> create user rman identified by rman default tablespace back_up temporary tablespace temp;
  
  User created
  
   給rman用戶授權
  
  SQL> grant connectresourcerecovery_catalog_owner to rman;
  
  Grant succeeded
  
  SQL> quit
  Disconnected from Oraclei Enterprise Edition Release bit Production
  With the Partitioning OLAP and Oracle Data Mining options
  JServer Release Production
  
   連接或者創建catalog到表空間 back_up
  
  bash$ rman
  
  Recovery Manager: Release bit Production
  
  Copyright (c) Oracle Corporation All rights reserved
  
  RMAN> connect catalog rman/rman;
  
  connected to recovery catalog database
  recovery catalog is not installed
  
  RMAN> create catalog tablespace backup;
  
  RMAN: ===========================================================
  RMAN: =============== ERROR MESSAGE STACK FOLLOWS ===============
  RMAN: ===========================================================
  RMAN: error encountered while parsing input commands
  RMAN: syntax error: found backup: expecting one of: doublequotedstring identifier singlequotedstring
  RMAN: at line column file: standard input
  
  RMAN: ===========================================================
  RMAN: =============== ERROR MESSAGE STACK FOLLOWS ===============
  RMAN: ===========================================================
  RMAN: error encountered while parsing input commands
  RMAN: syntax error: found ;: expecting one of: allocate alter backup beginline blockrecover catalog change connect copy create crosscheck configure duplicate debug delete drop exit endinline host { library list mount open print quit recover register release replace report renormalize reset restore resync rman run rpctest set setlimit sql spool startup shutdown send show test upgrade validate
  RMAN: at line column file: standard input
  
  RMAN> create catalog tablespace back_up;
  
  recovery catalog created
  
  RMAN> quit
  
  Recovery Manager complete
  
   連接到sid 為testmysiteok的 catalog上 並注冊testmysiteok數據庫
  
  bash$ rman target testmysiteok catalog rman/rman
  
  Recovery Manager: Release bit Production
  
  Copyright (c) Oracle Corporation All rights reserved
  
  target database Password:
  connected to target database: testmysiteOK (DBID=)
  connected to recovery catalog database
  
  RMAN> register database;
  
  database registered in recovery catalog
  starting full resync of recovery catalog
  full resync complete
  
   全備份testmysiteok數據庫
  
  RMAN> backup full tag testmysiteok format /data/ora_backup/testmysiteok_%u_%s_%p database;
  
  Starting backup at AUG
  allocated channel: ORA_DISK_
  channel ORA_DISK_: sid= devtype=DISK
  channel ORA_DISK_: starting full datafile backupset
  channel ORA_DISK_: specifying datafile(s) in backupset
  including current SPFILE in backupset
  including current controlfile in backupset
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/systemdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/undotbsdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/exampledbf
  input datafile fno= name=/oracle/oradata/webdb_filedbf
  input datafile fno= name=/oracle/oradata/webdb_filedbf
  input datafile fno= name=/oracle/oradata/webdb_filedbf
  input datafile fno= name=/oracle/oradata/webdb_filedbf
  input datafile fno= name=/oracle/oradata/catalogdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/xdbdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/indxdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/usersdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/cwmlitedbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/drsysdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/odmdbf
  input datafile fno= name=/oracle/oraclei/oradata/testmysiteok/toolsdbf
  channel ORA_DISK_: starting piece at AUG
  channel ORA_DISK_: finished piece at AUG
  piece handle=/data/ora_backup/testmysiteok_grgroc__ comment=NONE
  channel ORA_DISK_: backup set complete elapsed time: ::
  Finished backup at AUG
  
   設置保留最近的次備份
  
  RMAN> configure retention policy to redundancy ;
  
  old RMAN configuration parameters:
  CONFIGURE RETENTION POLICY TO REDUNDANCY ;
  new RMAN configuration parameters:
  CONFIGURE RETENTION POLICY TO REDUNDANCY ;
  new RMAN configuration parameters are successfully stored
  starting full resync of recovery catalog
  full resync complete
  
   查看過期的備份
  
  RMAN> report obsolete;
  
  RMAN retention policy will be applied to the command
  RMAN retention policy is set to redundancy
  Report of obsolete backups and copies
  Type         Key  Completion Time  Filename/Handle
  
  Backup Set        OCT
   Backup Piece      OCT     /oracle/testmysiteokdbf
  Archive Log       SEP     /oracle/OraHome/dbs/arch_dbf
  
   查看所有備份
  
  RMAN> list backup;
  
   刪除過期備份
  
  RMAN> delete obsolete;
  
  RMAN retention policy will be applied to the command
  RMAN retention policy is set to redundancy
  using channel ORA_DISK_
  Deleting the following obsolete backups and copies:
  Type         Key  Completion Time  Filename/Handle
  
  Backup Set        OCT
   Backup Piece      OCT     /oracle/testmysiteokdbf
  Archive Log       SEP     /oracle/OraHome/dbs/arch_dbf
  
  Do you really want to delete the above objects (enter YES or NO)? y
  deleted backup piece
  backup piece handle=/oracle/testmysiteokdbf recid= stamp=
  Deleted objects
From:http://tw.wingwit.com/Article/program/Oracle/201311/18428.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.