国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

SPFILE的備份與恢復一

2024-07-21 02:34:00
字體:
來源:轉載
供稿:網友

  六. SPFILE的備份與恢復
  
  在本文開篇我們提到,Oracle把Spfile也納入到Rman的備份恢復策略當中,假如你配置了控制文件自動備份(autoback),那么Oracle會在數據庫發生重大變化(如增減表空間)時自動進行控制文件及Spfile文件的備份。
  
  下面我們來看一下這個過程:
  
  a. 設置控制文件自動備份:
  
  [oracle@jumper oracle]$ rman target /
  
  Recovery Manager: Release 9.2.0.3.0 - PRodUCtion
  
  Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
  
  connected to target database: HSJF (DBID=1052178311)
  
  RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
  
  using target database controlfile instead of recovery catalog
  old RMAN configuration parameters:
  CONFIGURE CONTROLFILE AUTOBACKUP OFF;
  new RMAN configuration parameters:
  CONFIGURE CONTROLFILE AUTOBACKUP ON;
  new RMAN configuration parameters are successfully stored
  
  RMAN> exit
  
  這個設置可以在數據庫中通過如下方式查詢得到:
  
  [oracle@jumper bdump]$ sqlplus "/ as sysdba"
  
  SQL*Plus: Release 9.2.0.3.0 - Production on Sat Jan 17 01:08:05 2004
  
  Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
  
  Connected to:
  Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
  With the Partitioning, OLAP and Oracle Data Mining options
  JServer Release 9.2.0.3.0 - Production
  
  SQL> select * from v$rman_configuration;
  CONF# NAME VALUE
  ---------- ------------------------- ----------
  1 CONTROLFILE AUTOBACKUP ON
  
  b. 記錄數據庫變化
  
  SQL> create tablespace eygle
  2 datafile '/data1/oracle/oradata/eygle01.dbf'
  3 size 5M;
  
  Tablespace created.
  
  假如新創建一個表空間,這時候檢查alert<sid>.log文件,你可以在其中發現這樣的備份信息:
  
  Sat Jan 17 00:55:57 2004Starting control autobackupControl autobackup written to DISK devicehandle '/opt/oracle/product/9.2.0/dbs/c-1052178311-20040117-00'Completed: create tablespace eygledatafile '/data1/oracle/oradata/eygle01.dbf’
  
  假如使用rman進行備份,在提示中你可以看到如下信息:
  
  RMAN> configure controlfile autobackup on;
  
  old RMAN configuration parameters:
  CONFIGURE CONTROLFILE AUTOBACKUP OFF;
  new RMAN configuration parameters:
  CONFIGURE CONTROLFILE AUTOBACKUP ON;
  new RMAN configuration parameters are successfully stored
  
  RMAN> run
  2> {
  3> allocate channel ch1 type disk format='e:/oracle/orabak/penny%t.arc';
  4> backup archivelog all delete all input;
  5> release channel ch1;
  6> }
  
  allocated channel: ch1
  channel ch1: sid=13 devtype=DISK
  
  Starting backup at 02-DEC-03
  current log archived
  channel ch1: starting archive log backupset
  channel ch1: specifying archive log(s) in backup set
  input archive log thread=1 sequence=63 recid=168 stamp=511712617
  input archive log thread=1 sequence=64 recid=169 stamp=511712620
  input archive log thread=1 sequence=65 recid=170 stamp=511712626
  input archive log thread=1 sequence=66 recid=171 stamp=511712690
  channel ch1: starting piece 1 at 02-DEC-03
  channel ch1: finished piece 1 at 02-DEC-03
  piece handle=E:/ORACLE/ORABAK/PENNY511712693.ARC comment=NONE
  channel ch1: backup set complete, elapsed time: 00:00:03
  channel ch1: deleting archive log(s)
  archive log filename=E:/ORACLE/ORADATA/PENNY/ARCHIVE/1_63.DBF recid=168 stamp=511712617
  archive log filename=E:/ORACLE/ORADATA/PENNY/ARCHIVE/1_64.DBF recid=169 stamp=511712620
  archive log filename=E:/ORACLE/ORADATA/PENNY/ARCHIVE/1_65.DBF recid=170 stamp=511712626
  archive log filename=E:/ORACLE/ORADATA/PENNY/ARCHIVE/1_66.DBF recid=171 stamp=511712690
  Finished backup at 02-DEC-03
  
  Starting Control File and SPFILE Autobackup at 02-DEC-03
  piece handle=E:/ORACLE/ORA92/DATABASE/C-3627775766-20031202-01 comment=NONE
  Finished Control File and SPFILE Autobackup at 02-DEC-03
  
  released channel: ch1
  
  我們簡單看一下自動備份的控制文件及spfile文件的格式及命名規則:
  c-IIIIIIIIII-YYYYMMDD-QQ
  c ------------------------控制文件
  IIIIIIIIII---------DBID
  YYYYMMDD------------時間戳
  QQ----------------------序號00-FF,16進制表示
  
  c. 使用自動備份恢復spfile文件
  
  [oracle@jumper bdump]$ rman target /
  
  Recovery Manager: Release 9.2.0.3.0 - Production
  
  Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
  
  connected to target database: HSJF (DBID=1052178311)
  
  RMAN> restore spfile to '/tmp/spfileeygle.ora' from autobackup;

  
  Starting restore at 17-JAN-04
  
  using target database controlfile instead of recovery catalog
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=18 devtype=DISK
  channel ORA_DISK_1: looking for autobackup on day: 20040117
  channel ORA_DISK_1: autobackup found: c-1052178311-20040117-01
  channel ORA_DISK_1: SPFILE restore from autobackup complete
  Finished restore at 17-JAN-04
  
  RMAN> exit
  
  Recovery Manager complete.
  [oracle@jumper bdump]$ ls -l /tmp/spfileeygle.ora
  -rw-r----- 1 oracle dba 3584 1月 17 09:34 /tmp/spfileeygle.ora
  
  你同樣可以通過這種方法恢復控制文件,示例如下:
  
  [oracle@jumper bdump]$ rman target /
  
  Recovery Manager: Release 9.2.0.3.0 - Production
  
  Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
  
  connected to target database: HSJF (DBID=1052178311)
  
  RMAN> restore controlfile to '/tmp/control01.ctl' from autobackup;
  
  Starting restore at 17-JAN-04
  
  using target database controlfile instead of recovery catalog
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=10 devtype=DISK
  channel ORA_DISK_1: looking for autobackup on day: 20040117
  channel ORA_DISK_1: autobackup found: c-1052178311-20040117-02
  channel ORA_DISK_1: controlfile restore from autobackup complete
  Finished restore at 17-JAN-04
  
  RMAN> exit
  
  Recovery Manager complete.
  [oracle@jumper bdump]$ ls -l /tmp/control*
  -rw-r----- 1 oracle dba 1892352 1月 17 09:44 /tmp/control01.ctl
  
  Oracle9i自動備份控制文件的功能給我們帶來了極大的收益,通過自動備份,在數據庫出現緊急狀況的時候,你可能可以從這個自動備份中獲得更為有效及時的控制文件.
  
  缺省的,這個自動備份功能是關閉的,你可以用我們上面提到的方法打開該功能.
  
  七. 設置Events事件
  
  Events事件是Oracle的重要診斷工具及問題解決辦法,很多時候需要通過Events設置來屏蔽或者更改Oracle的行為,下面我們來看一下怎樣修改spfile,增加Events事件設置:
  
  SQL> alter system set event='10841 trace name context forever' scope=spfile;
  
  System altered.
  
  SQL> startup force;
  ORACLE instance started.
  
  Total System Global Area 101782380 bytes
  Fixed Size 451436 bytes
  Variable Size 75497472 bytes
  Database Buffers 25165824 bytes
  Redo Buffers 667648 bytes
  Database mounted.
  Database opened.
  SQL> show parameter event
  
  NAME TYPE VALUE
  ------------------------------------ ----------- ------------------------------
  event string 10841 trace name context forever
  
  順便提一句,10841事件是用于解決Oracle9i中JDBC Thin Driver問題的一個方法,假如你的alert.log文件中出現以下錯誤提示:
  
  Wed Jan 7 17:17:08 2004
  Errors in file /opt/oracle/admin/phsdb/udump/phsdb_ora_1775.trc:
  ORA-00600: internal error code, argument

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 杂多县| 治县。| 普定县| 新安县| 大渡口区| 策勒县| 菏泽市| 东乡族自治县| 新晃| 新乡县| 丁青县| 潮州市| 个旧市| 城固县| 静乐县| 波密县| 彰化县| 荔浦县| 东平县| 青河县| 永川市| 同心县| 章丘市| 湄潭县| 南昌市| 高雄市| 明光市| 环江| 安达市| 丹阳市| 广东省| 东至县| 广昌县| 鹰潭市| 仪征市| 连州市| 乌兰县| 和林格尔县| 白水县| 通辽市| 呼伦贝尔市|