Windows Server 2008下ORACLE 10G 10204 重建資料庫

stonebox1122發表於2015-09-12

目錄

1. 系統資訊

2. 安裝虛擬機器

3. 安裝建立資料庫

4. 源資料庫操作

5. 新資料庫操作

 

 

1. 系統資訊

序號

角色

作業系統

版本

記憶體

磁碟

防火牆

IP地址

1

源資料庫

Windows Server

2008 R2

2G

40G

關閉

192.168.230.132

2

新資料庫

Windows Server

2008 R2

2G

40G

關閉

192.168.230.133

 

 

2. 安裝虛擬機器

參考http://blog.itpub.net/28536251/viewspace-1455381/安裝Windows系統。

 

 

3. 安裝建立資料庫

分別在2個虛擬機器上面安裝建立資料庫。

執行安裝程式。

clip_image002

由於只是測試,選擇基本安裝。

clip_image004

clip_image006

clip_image008

clip_image010

clip_image012

clip_image014

clip_image016

clip_image018

clip_image020

 

 

4. 源資料庫操作

確認資料庫執行在非歸檔模式,且沒有RMAN備份。

建立使用者,表空間及資料檔案,並建立一張表,插入2行資料。

C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Sep 12 12:01:56 2015

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select status from v$instance;

STATUS

------------

OPEN

SQL> archive log list;

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 1

Current log sequence 2

SQL> create tablespace AppGov datafile 'C:\oracle\product\10.2.0\oradata\orcl\Ap

pGov_oradata.DBF' size 10M autoextend on;

Tablespace created.

SQL> create user CM identified by CM default tablespace AppGov;

User created.

SQL> grant resource, connect, dba, create view to CM;

Grant succeeded.

SQL> conn CM/CM

Connected.

SQL> create table test(id number,name varchar2(10));

Table created.

SQL> insert into test values(1,'aa');

1 row created.

SQL> insert into test values(2,'bb');

1 row created.

SQL> select * from test;

ID NAME

---------- ----------

1 aa

2 bb

SQL> commit;

Commit complete.

模擬掉電故障。

SQL> conn sys/password as sysdba;

Connected.

SQL> shutdown abort;

ORACLE instance shut down.

 

 

5. 新資料庫操作

源資料庫如果出現問題,先保留現場,不去操作,將所有資料檔案,日誌檔案,控制檔案等複製到新建資料庫的對應目錄,最好是相同的目錄結構,並覆蓋原始檔。

先關閉新資料庫。

C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Sep 12 12:20:06 2015

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

複製資料後啟動資料庫。

C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Sep 12 13:09:03 2015

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 612368384 bytes

Fixed Size 2067656 bytes

Variable Size 167772984 bytes

Database Buffers 436207616 bytes

Redo Buffers 6320128 bytes

Database mounted.

Database opened.

SQL> conn CM/CM

Connected.

SQL> select * from test;

ID NAME

---------- ----------

1 aa

2 bb

啟動資料庫正常,資料還在。

 

 

 

如果複製檔案的位置與源資料庫不一致,則需要重建控制檔案。

C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Sep 12 13:13:21 2015

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 612368384 bytes

Fixed Size 2067656 bytes

Variable Size 167772984 bytes

Database Buffers 436207616 bytes

Redo Buffers 6320128 bytes

ORA-00205: error in identifying control file, check alert log for more info

啟動報識別控制檔案錯誤,檢視告警日誌:

ORA-00202: control file: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL'

ORA-27041: unable to open file

OSD-04002: unable to open file

O/S-Error: (OS 3) 系統找不到指定的路徑。

先修改引數檔案中控制檔案的新的位置:

SQL> startup nomount;

ORACLE instance started.

Total System Global Area 612368384 bytes

Fixed Size 2067656 bytes

Variable Size 167772984 bytes

Database Buffers 436207616 bytes

Redo Buffers 6320128 bytes

SQL> create pfile='C:\oracle\product\10.2.0\db_1\database\pfile.ora' from spfile;

File created.

orcl.__db_cache_size=436207616

orcl.__java_pool_size=4194304

orcl.__large_pool_size=4194304

orcl.__shared_pool_size=159383552

orcl.__streams_pool_size=0

*.audit_file_dest='C:\oracle\product\10.2.0\admin\orcl\adump'

*.background_dump_dest='C:\oracle\product\10.2.0\admin\orcl\bdump'

*.compatible='10.2.0.3.0'

*.control_files='C:\orcl\control01.ctl','C:\orcl\control02.ctl','C:\orcl\control03.ctl'

*.core_dump_dest='C:\oracle\product\10.2.0\admin\orcl\cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='orcl'

*.db_recovery_file_dest='C:\oracle\product\10.2.0\flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'

*.job_queue_processes=10

*.open_cursors=300

*.pga_aggregate_target=203423744

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=612368384

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='C:\oracle\product\10.2.0\admin\orcl\udump'

然後使用該引數檔案啟動。

SQL> startup mount pfile='C:\oracle\product\10.2.0\db_1\database\pfile.ora';

ORACLE instance started.

Total System Global Area 612368384 bytes

Fixed Size 2067656 bytes

Variable Size 167772984 bytes

Database Buffers 436207616 bytes

Redo Buffers 6320128 bytes

Database mounted.

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'

提示資料檔案1識別錯誤。需要重建控制檔案,指定相關檔案的位置了。

先生成控制檔案重建指令碼

SQL> alter database backup controlfile to trace as 'C:\orcl\control001.trc';

Database altered.

指令碼內容分為noretlogs和resetlogs兩種情況,具體如下:

-- The following are current System-scope REDO Log Archival related

-- parameters and can be included in the database initialization file.

--

-- LOG_ARCHIVE_DEST=''

-- LOG_ARCHIVE_DUPLEX_DEST=''

--

-- LOG_ARCHIVE_FORMAT=ARC%S_%R.%T

--

-- DB_UNIQUE_NAME="orcl"

--

-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'

-- LOG_ARCHIVE_MAX_PROCESSES=2

-- STANDBY_FILE_MANAGEMENT=MANUAL

-- STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS

-- FAL_CLIENT=''

-- FAL_SERVER=''

--

-- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'

-- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'

-- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'

-- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'

-- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'

-- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'

-- LOG_ARCHIVE_DEST_STATE_10=ENABLE

--

-- Below are two sets of SQL statements, each of which creates a new

-- control file and uses it to open the database. The first set opens

-- the database with the NORESETLOGS option and should be used only if

-- the current versions of all online logs are available. The second

-- set opens the database with the RESETLOGS option and should be used

-- if online logs are unavailable.

-- The appropriate set of statements can be copied from the trace into

-- a script file, edited as necessary, and executed when there is a

-- need to re-create the control file.

--

-- Set #1. NORESETLOGS case

--

-- The following commands will create a new control file and use it

-- to open the database.

-- Data used by Recovery Manager will be lost.

-- Additional logs may be required for media recovery of offline

-- Use this only if the current versions of all online logs are

-- available.

-- After mounting the created controlfile, the following SQL

-- statement will place the database in the appropriate

-- protection mode:

-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,

GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,

GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M

-- STANDBY LOGFILE

DATAFILE

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\APPGOV_ORADATA.DBF'

CHARACTER SET AL32UTF8

;

-- Commands to re-create incarnation table

-- Below log names MUST be changed to existing filenames on

-- disk. Any one log file from each branch can be used to

-- re-create incarnation records.

-- ALTER DATABASE REGISTER LOGFILE 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2015_09_12\O1_MF_1_1_%U_.ARC';

-- ALTER DATABASE REGISTER LOGFILE 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2015_09_12\O1_MF_1_1_%U_.ARC';

-- Recovery is required if any of the datafiles are restored backups,

-- or if the last shutdown was not normal or immediate.

RECOVER DATABASE

-- Database can now be opened normally.

ALTER DATABASE OPEN;

-- Commands to add tempfiles to temporary tablespaces.

-- Online tempfiles have complete space information.

-- Other tempfiles may require adjustment.

ALTER TABLESPACE TEMP ADD TEMPFILE 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP01.DBF' REUSE;

-- End of tempfile additions.

--

-- Set #2. RESETLOGS case

--

-- The following commands will create a new control file and use it

-- to open the database.

-- Data used by Recovery Manager will be lost.

-- The contents of online logs will be lost and all backups will

-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL

-- statement will place the database in the appropriate

-- protection mode:

-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,

GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,

GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M

-- STANDBY LOGFILE

DATAFILE

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF',

'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\APPGOV_ORADATA.DBF'

CHARACTER SET AL32UTF8

;

-- Commands to re-create incarnation table

-- Below log names MUST be changed to existing filenames on

-- disk. Any one log file from each branch can be used to

-- re-create incarnation records.

-- ALTER DATABASE REGISTER LOGFILE 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2015_09_12\O1_MF_1_1_%U_.ARC';

-- ALTER DATABASE REGISTER LOGFILE 'C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2015_09_12\O1_MF_1_1_%U_.ARC';

-- Recovery is required if any of the datafiles are restored backups,

-- or if the last shutdown was not normal or immediate.

RECOVER DATABASE USING BACKUP CONTROLFILE

-- Database can now be opened zeroing the online logs.

ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.

-- Online tempfiles have complete space information.

-- Other tempfiles may require adjustment.

ALTER TABLESPACE TEMP ADD TEMPFILE 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP01.DBF' REUSE;

-- End of tempfile additions.

--

如果聯機重做日誌檔案可用,則使用noresetlogs;

如果聯機重做日誌檔案損壞,則使用resetlogs。

此處先使用noretlogs建立控制檔案,並根據路徑調整指令碼,具體如下:

CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 'C:\ORCL\REDO01.LOG' SIZE 50M,

GROUP 2 'C:\ORCL\REDO02.LOG' SIZE 50M,

GROUP 3 'C:\ORCL\REDO03.LOG' SIZE 50M

DATAFILE

'C:\ORCL\SYSTEM01.DBF',

'C:\ORCL\UNDOTBS01.DBF',

'C:\ORCL\SYSAUX01.DBF',

'C:\ORCL\USERS01.DBF',

'C:\ORCL\EXAMPLE01.DBF',

'C:\ORCL\APPGOV_ORADATA.DBF'

CHARACTER SET AL32UTF8

;

具體操作如下:

SQL> startup nomount pfile='C:\oracle\product\10.2.0\db_1\database\pfile.ora';

ORACLE instance started.

Total System Global Area 612368384 bytes

Fixed Size 2067656 bytes

Variable Size 167772984 bytes

Database Buffers 436207616 bytes

Redo Buffers 6320128 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG

2 MAXLOGFILES 16

3 MAXLOGMEMBERS 3

4 MAXDATAFILES 100

5 MAXINSTANCES 8

6 MAXLOGHISTORY 292

7 LOGFILE

8 GROUP 1 'C:\orcl\REDO01.LOG' SIZE 50M,

9 GROUP 2 'C:\orcl\REDO02.LOG' SIZE 50M,

10 GROUP 3 'C:\orcl\REDO03.LOG' SIZE 50M

11 DATAFILE

12 'C:\orcl\SYSTEM01.DBF',

13 'C:\orcl\UNDOTBS01.DBF',

14 'C:\orcl\SYSAUX01.DBF',

15 'C:\orcl\USERS01.DBF',

16 'C:\orcl\EXAMPLE01.DBF',

17 'C:\orcl\APPGOV_ORADATA.DBF'

18 CHARACTER SET AL32UTF8

19 ;

Control file created.

SQL> recover database;

ORA-00283: recovery session canceled due to errors

ORA-00264: no recovery required

SQL> alter database open;

Database altered.

SQL> alter tablespace temp add tempfile 'C:\orcl\TEMP01.DBF' reuse;

Tablespace altered.

SQL> select * from CM.test;

ID NAME

---------- ----------

1 aa

2 bb

開啟資料庫正常,資料也ok。

 

 

再使用retlogs建立控制檔案,並根據路徑調整指令碼,具體如下:

CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 'C:\orcl\REDO01.LOG' SIZE 50M,

GROUP 2 'C:\orcl\REDO02.LOG' SIZE 50M,

GROUP 3 'C:\orcl\REDO03.LOG' SIZE 50M

DATAFILE

'C:\orcl\SYSTEM01.DBF',

'C:\orcl\UNDOTBS01.DBF',

'C:\orcl\SYSAUX01.DBF',

'C:\orcl\USERS01.DBF',

'C:\orcl\EXAMPLE01.DBF',

'C:\orcl\APPGOV_ORADATA.DBF'

CHARACTER SET AL32UTF8

;

具體操作如下:

SQL> startup nomount pfile='C:\oracle\product\10.2.0\db_1\database\pfile.ora';

ORACLE instance started.

Total System Global Area 612368384 bytes

Fixed Size 2067656 bytes

Variable Size 167772984 bytes

Database Buffers 436207616 bytes

Redo Buffers 6320128 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG

2 MAXLOGFILES 16

3 MAXLOGMEMBERS 3

4 MAXDATAFILES 100

5 MAXINSTANCES 8

6 MAXLOGHISTORY 292

7 LOGFILE

8 GROUP 1 'C:\orcl\REDO01.LOG' SIZE 50M,

9 GROUP 2 'C:\orcl\REDO02.LOG' SIZE 50M,

10 GROUP 3 'C:\orcl\REDO03.LOG' SIZE 50M

11 DATAFILE

12 'C:\orcl\SYSTEM01.DBF',

13 'C:\orcl\UNDOTBS01.DBF',

14 'C:\orcl\SYSAUX01.DBF',

15 'C:\orcl\USERS01.DBF',

16 'C:\orcl\EXAMPLE01.DBF',

17 'C:\orcl\APPGOV_ORADATA.DBF'

18 CHARACTER SET AL32UTF8

19 ;

Control file created.

檢視系統檢查點SCN(儲存在控制檔案中):

SQL> select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#

------------------

0

檢視資料檔案檢查點SCN(儲存在控制檔案中):

SQL> select name,checkpoint_change# from v$datafile;

NAME CHECKPOINT_CHANGE#

------------------------------ ------------------

C:\ORCL\SYSTEM01.DBF 661835

C:\ORCL\UNDOTBS01.DBF 661835

C:\ORCL\SYSAUX01.DBF 661835

C:\ORCL\USERS01.DBF 661835

C:\ORCL\EXAMPLE01.DBF 661835

C:\ORCL\APPGOV_ORADATA.DBF 661835

6 rows selected.

啟動SCN(儲存在資料檔案頭)

SQL> select name,checkpoint_change# from v$datafile_header;

NAME CHECKPOINT_CHANGE#

------------------------------ ------------------

C:\ORCL\SYSTEM01.DBF 661835

C:\ORCL\UNDOTBS01.DBF 661835

C:\ORCL\SYSAUX01.DBF 661835

C:\ORCL\USERS01.DBF 661835

C:\ORCL\EXAMPLE01.DBF 661835

C:\ORCL\APPGOV_ORADATA.DBF 661835

6 rows selected.

終止SCN(儲存在控制檔案中):

SQL> select name,last_change# from v$datafile;

NAME LAST_CHANGE#

------------------------------ ------------

C:\ORCL\SYSTEM01.DBF

C:\ORCL\UNDOTBS01.DBF

C:\ORCL\SYSAUX01.DBF

C:\ORCL\USERS01.DBF

C:\ORCL\EXAMPLE01.DBF

C:\ORCL\APPGOV_ORADATA.DBF

6 rows selected.

可以看到系統檢查點SCN不等於資料檔案檢查點SCN,需要進行恢復。

SQL> RECOVER DATABASE USING BACKUP CONTROLFILE

ORA-00279: change 661835 generated at 09/12/2015 13:48:58 needed for thread 1

ORA-00289: suggestion :

C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2015_09_12\O1_MF_1_

4_%U_.ARC

ORA-00280: change 661835 for thread 1 is in sequence #4

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

cancel

Media recovery cancelled.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01113: file 1 needs media recovery

ORA-01110: data file 1: 'C:\ORCL\SYSTEM01.DBF'

SQL> recover database using backup controlfile;

ORA-00279: change 661835 generated at 09/12/2015 13:48:58 needed for thread 1

ORA-00289: suggestion :

C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2015_09_12\O1_MF_1_

4_%U_.ARC

ORA-00280: change 661835 for thread 1 is in sequence #4

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

C:\orcl\REDO01.log

Log applied.

Media recovery complete.

以上說明是需要一個歸檔日誌檔案進行恢復,但是源資料庫沒有執行在歸檔模式,沒有歸檔檔案,只能使用聯機日誌檔案進行恢復,我這裡使用第一個聯機日誌檔案恢復成功,如果不行,依次使用現有的聯機日誌檔案進行測試恢復,成功為止。

SQL> alter database open resetlogs;

Database altered.

SQL> select * from CM.test;

ID NAME

---------- ------------------------------

1 aa

2 bb

SQL> select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#

------------------

661838

SQL> select name,checkpoint_change# from v$datafile;

NAME CHECKPOINT_CHANGE#

------------------------------ ------------------

C:\ORCL\SYSTEM01.DBF 661838

C:\ORCL\UNDOTBS01.DBF 661838

C:\ORCL\SYSAUX01.DBF 661838

C:\ORCL\USERS01.DBF 661838

C:\ORCL\EXAMPLE01.DBF 661838

C:\ORCL\APPGOV_ORADATA.DBF 661838

6 rows selected.

SQL> select name,checkpoint_change# from v$datafile_header;

NAME CHECKPOINT_CHANGE#

------------------------------ ------------------

C:\ORCL\SYSTEM01.DBF 661838

C:\ORCL\UNDOTBS01.DBF 661838

C:\ORCL\SYSAUX01.DBF 661838

C:\ORCL\USERS01.DBF 661838

C:\ORCL\EXAMPLE01.DBF 661838

C:\ORCL\APPGOV_ORADATA.DBF 661838

6 rows selected.

SQL> select name,last_change# from v$datafile;

NAME LAST_CHANGE#

------------------------------ ------------

C:\ORCL\SYSTEM01.DBF

C:\ORCL\UNDOTBS01.DBF

C:\ORCL\SYSAUX01.DBF

C:\ORCL\USERS01.DBF

C:\ORCL\EXAMPLE01.DBF

C:\ORCL\APPGOV_ORADATA.DBF

6 rows selected.

SCN一致了。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28536251/viewspace-1798150/,如需轉載,請註明出處,否則將追究法律責任。

相關文章