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

首頁 > 開發(fā) > 綜合 > 正文

rman備份,未用catalog,控制文件丟失的解決(1)

2024-07-21 02:34:24
字體:
供稿:網(wǎng)友
情況描述客戶報告數(shù)據(jù)庫故障,新來的系統(tǒng)治理員誤操作。刪掉了一些文件。
詢問:刪掉了那些文件?
答曰:所有重要數(shù)據(jù)文件,所有控制文件。數(shù)據(jù)庫原來是歸檔模式,用rman備份數(shù)據(jù),rman 使用控制文件。
幸運(yùn)的是,最后一次rman full 備份是包括了控制文件在內(nèi)。系統(tǒng)沒有設(shè)定自動備份控制文件.現(xiàn)在狀況是數(shù)據(jù)庫無法啟動. 不用說,客戶的備份方案不夠完善,但是這時候再去說這些話責(zé)備用戶有事后諸葛亮之嫌,用戶是上帝,不要去得罪他。還有,客戶有Full備份(雖然不是自動備份控制文件,這樣無法用常規(guī)的恢復(fù)步驟來進(jìn)行恢復(fù))。這對我們來說是個絕對的好消息。下面我們通過一次模擬操作來演示這個問題的解決辦法。
解決過程首先,用控制文件作數(shù)據(jù)庫系統(tǒng)的全備份: 代碼:------------------------藍(lán)色部分是輸入內(nèi)容,黑色部分是敏感信息,須加以注重----------------------------------------------------
C:WUTemp>rman target / Recovery Manager: Release 9.2.0.1.0 - PRodUCtion.Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.connected to target database: DEMO (DBID=3272375326)RMAN> run {
2> allocate channel C1 type disk;
3> backup full tag 'FullBackup' format 'd:/KDE/%d_%u_%s_%p.dbf' database include current controlfile;
4> sql ' alter system archive log current';
5> release channel C1;
6> }using target database controlfile instead of recovery catalog
allocated channel: C1
channel C1: sid=15 devtype=DISKStarting backup at 18-JUL-04
channel C1: starting full datafile backupset
channel C1: specifying datafile(s) in backupset
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00001 name=D:/ORACLE/ORADATA/DEMO/SYSTEM01.DBF
input datafile fno=00002 name=D:/ORACLE/ORADATA/DEMO/UNDOTBS01.DBF
input datafile fno=00004 name=D:/ORACLE/ORADATA/DEMO/EXAMPLE01.DBF
input datafile fno=00009 name=D:/ORACLE/ORADATA/DEMO/XDB01.DBF
input datafile fno=00005 name=D:/ORACLE/ORADATA/DEMO/INDX01.DBF
input datafile fno=00008 name=D:/ORACLE/ORADATA/DEMO/USERS01.DBF
input datafile fno=00003 name=D:/ORACLE/ORADATA/DEMO/DRSYS01.DBF
input datafile fno=00006 name=D:/ORACLE/ORADATA/DEMO/ODM01.DBF
input datafile fno=00007 name=D:/ORACLE/ORADATA/DEMO/TOOLS01.DBF
channel C1: starting piece 1 at 18-JUL-04
channel C1: finished piece 1 at 18-JUL-04
piece handle=D:/KDE/DEMO_01FR79OT_1_1.DBF comment=NONE
channel C1: backup set complete, elapsed time: 00:01:17
Finished backup at 18-JUL-04sql statement: alter system archive log currentreleased channel: C1--如上所示,我們做了一次數(shù)據(jù)庫的Full備份.備份片中包括控制文件.注重上面輸出內(nèi)容的黑體部分.我們在后面的恢復(fù)操作中會用到. 模擬錯誤,關(guān)掉實(shí)例,刪掉所有的控制文件和所有的.DBF文件。然后starup會看到如下的出錯信息:SQL> startup
ORACLE instance started.Total System Global Area 152115804 bytes
Fixed Size 453212 bytes
Variable Size 100663296 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
ORA-00205: error in identifying controlfile, check alert log for more info
查看alert Log,應(yīng)該是系統(tǒng)找不到控制文件.現(xiàn)在情形和客戶問題一致.不過在繼續(xù)講述之前,我們還需要介紹一點(diǎn)背景知識.
背景知識: 在Oracle 816 以后的版本中,Oracle提供了一個包:DBMS_BACKUP_RESTORE.DBMS_BACKUP_RESTORE 包是由dbmsbkrs.sql 和 prvtbkrs.plb 這兩個腳本創(chuàng)建的.catproc.sql 腳本運(yùn)行后會調(diào)用這兩個包.所以是每個數(shù)據(jù)庫都有的這個包是Oracle服務(wù)器和操作系統(tǒng)之間IO操作的接口.由恢復(fù)治理器直接調(diào)用。而且據(jù)說這兩個腳本的功能是內(nèi)建到Oracle的一些庫文件中的.由此可見,我們可以在數(shù)據(jù)庫 nomount 情況下調(diào)用這些package ,來達(dá)到我們的恢復(fù)目的。在dbmsbkrs.sql 和prvtbkrs.plb 這兩個腳本中有具體的說明文檔,出于篇幅問題,就不一一加以翻譯了,但在下面會直接引用一些原文說明。要害的內(nèi)容有:FUNCTION  deviceAllocate(
       type IN varchar2 default NULL
      ,name IN varchar2 default NULL
      ,ident IN varchar2 default NULL
      ,noio IN boolean default FALSE
      ,params IN varchar2 default NULL )
RETURN varchar2;-- Describe the device to be used for sequential I/O. For device types where
-- only one process at a time can use a device, this call allocates a device
-- for exclusive use by this session. The device remains allocated until
-- deviceDeallocate is called or session termination. The device can be used
-- both for creating and restoring backups.
--
-- Specifying a device allocates a context that exists until the session
-- terminates or deviceDeallocate is called. Only one device can be specified
-- at a time for a particular session. Thus deviceDeallocate must be called
-- before a different device can be specified. This is not a limitation since
-- a session can only read or write one backup at a time.
--
-- The other major effect of allocating a device is to specify the name space
-- for the backup handles (file names). The handle for a sequential file does
-- not necessarily define the type of device used to write the file. Thus it
-- is necessary to specify the device type in order to interpret the file
-- handle. The NULL device type is defined for all systems. It is the file
-- system supplied by the Operating system. The sequential file handles are
-- thus normal file names.
--
-- A device can be specified either by name or by type.
-- If the type is specified but not the name, the system picks an
-- available device of that type.
-- If the name is specified but not the type, the type is determined
-- from the device.
-- If neither the type or the name is given, the backups are files in
-- the operating system file system.-- Note that some types of devices, optical disks for example, can be shared
-- by many processes, and thus do not really require allocation of the device
-- itself. However we do need to allocate the context for accessing the
-- device, and we do need to know the device type for proper interpretation
-- of the file handle. Thus it is always necessary to make the device
-- allocation call before making most other calls in this package.
--
-- Input parameters:
-- type
-- If specified,
this gives the type of device to use for sequential
-- I/O. The allowed types are port specific. For example a port may
-- support the type "TAPE" which is implemented via the Oracle tape
-- API. If no type is specified, it may be implied by specifying a
-- particular device name to allocate. The type should be allowed to
-- default to NULL if operating system files are to be used.
--
-- name
-- If specified, this names a particular piece of hardware to use for
-- accessing sequential files. If not specified, any available
-- device of the correct type will be allocated. If the device cannot
-- be shared, it is allocated to this session for exclusive use.
-- The name should be allowed to default to NULL if operating system
-- files are to be used.
--
-- ident
-- This is the users identifier that he uses to name this device. It
-- is only used to report the status of this session via
-- dbms_application_info. This value will be placed in the CLIENT_INFO
-- column of the V$SESSION table, in the row corresponding to the
-- session in which the device was allocated. This value can also
-- be queried with the dbms_application_info.read_client_info procedure.
--
-- noio
-- If TRUE, the device will not be used for doing any I/O. This allows
-- the specification of a device type for deleting sequential files
-- without actually allocating a piece of hardware. An allocation for
-- noio can also be used for issuing device commands. Note that some
-- commands may actually require a physical device and thus will get
-- an error if the allocate was done with noio set to TRUE.
--
-- params
-- This string is simply passed to the device allocate OSD. It is
-- completely port and device specific.
--
-- Returns:
-- It returns a valid device type. This is the type that should be
-- allocated to access the same sequential files at a later date. Note
-- that this might not be exactly the same value as the input string.
-- The allocate OSD may do some translation of the type passed in. The
-- return value is NULL when using operating system files.


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 台前县| 河西区| 英吉沙县| 津南区| 七台河市| 汝城县| 巢湖市| 兰考县| 乐亭县| 桐庐县| 精河县| 建平县| 樟树市| 扬中市| 英吉沙县| 洪洞县| 句容市| 赞皇县| 山阳县| 贞丰县| 昌都县| 桓台县| 抚顺县| 莫力| 吉首市| 扎赉特旗| 定安县| 英超| 沅江市| 石林| 内丘县| 浮山县| 游戏| 凤凰县| 来安县| 汝阳县| 昌邑市| 岳普湖县| 洮南市| 新化县| 塔河县|