记录源端windows上oracle的dbid
SQL> select dbid from v$database; DBID ---------- 66428446
RMAN> RUN{ 2> ALLOCATE CHANNEL C1 TYPE DISK; 3> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT'; 4> BACKUP AS BACKUPSET FORMAT 'c:\bak\%T_%s_%p_BAK_DATA' DATABASE; 5> BACKUP ARCHIVELOG ALL FORMAT 'c:\bak\%T_%s_%p_BAK_ARC' DELETE INPUT; 6> BACKUP CURRENT CONTROLFILE FORMAT 'c:\bak\%U_BAK_CTL'; 7> RELEASE CHANNEL C1; 8> } 使用目标数据库控制文件替代恢复目录 分配的通道: C1 通道 C1: sid=521 devtype=DISK sql 语句: ALTER SYSTEM ARCHIVE LOG CURRENT 启动 backup 于 10-2月 -14 通道 C1: 启动全部数据文件备份集 通道 C1: 正在指定备份集中的数据文件 输入数据文件 fno=00001 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\SYSTEM01.DBF 输入数据文件 fno=00003 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\SYSAUX01.DBF 输入数据文件 fno=00005 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\EXAMPLE01.DBF 输入数据文件 fno=00006 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\ZWC.DBF 输入数据文件 fno=00002 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\UNDOTBS01.DBF 输入数据文件 fno=00004 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\USERS01.DBF 通道 C1: 正在启动段 1 于 10-2月 -14 MAN-03009: backup 命令 (C1 通道上, 在 02/10/2014 21:50:37 上) 失败 ORA-19566: 超出损坏块限制 0 (文件 C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\ZWC.DBF) 继续执行其它作业步骤, 将不重新运行失败的作业 通道 C1: 启动全部数据文件备份集 通道 C1: 正在指定备份集中的数据文件 备份集中包括当前控制文件 在备份集中包含当前的 SPFILE 通道 C1: 正在启动段 1 于 10-2月 -14 通道 C1: 已完成段 1 于 10-2月 -14 段句柄=C:\BAK\20140210_9_1_BAK_DATA 标记=TAG20140210T215036 注释=NONE 通道 C1: 备份集已完成, 经过时间:00:00:02 释放的通道: C1 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: ===========================================================
C:\>dbv file=C:\oracle\product\10.2.0\oradata\dbserver\zwc.dbf DBVERIFY: Release 10.2.0.4.0 - Production on 星期一 2月 10 21:47:45 2014 Copyright (c) 1982, 2007, Oracle. All rights reserved. DBVERIFY - 开始验证: FILE = C:\oracle\product\10.2.0\oradata\dbserver\zwc.dbf 页 1129 标记为损坏 Corrupt block relative dba: 0x01800469 (file 6, block 1129) Bad check value found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x01800469 last change scn: 0x0000.0009c385 seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xc3850601 check value in block header: 0x9a56 computed block checksum: 0xd64e 页 1132 标记为损坏 Corrupt block relative dba: 0x0180046c (file 6, block 1132) Bad check value found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x0180046c last change scn: 0x0000.0009c385 seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xc3850601 check value in block header: 0xd748 computed block checksum: 0x7e6 DBVERIFY - 验证完成 检查的页总数: 12800 处理的页总数 (数据): 12135 失败的页总数 (数据): 0 处理的页总数 (索引): 0 失败的页总数 (索引): 0 处理的页总数 (其它): 159 处理的总页数 (段) : 0 失败的总页数 (段) : 0 空的页总数: 504 标记为损坏的总页数: 2 流入的页总数: 0 最高块 SCN : 639878 (0.639878) C:\>
恢复管理器: Release 10.2.0.4.0 - Production on 星期一 2月 10 21:58:28 2014 Copyright (c) 1982, 2007, Oracle. All rights reserved. 连接到目标数据库: DBSERVER (DBID=66428446) RMAN> RMAN> RMAN> run{ 2> ALLOCATE CHANNEL C1 TYPE DISK; 3> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT'; 4> SET MAXCORRUPT FOR DATAFILE 6 TO 2; 5> BACKUP AS BACKUPSET FORMAT 'c:\bak\%T_%s_%p_BAK_DATA' DATABASE; 6> BACKUP ARCHIVELOG ALL FORMAT 'c:\bak\%T_%s_%p_BAK_ARC' DELETE INPUT; 7> BACKUP CURRENT CONTROLFILE FORMAT 'c:\bak\%U_BAK_CTL'; 8> RELEASE CHANNEL C1; 9> } 使用目标数据库控制文件替代恢复目录 分配的通道: C1 通道 C1: sid=521 devtype=DISK sql 语句: ALTER SYSTEM ARCHIVE LOG CURRENT 正在执行命令: SET MAX CORRUPT 启动 backup 于 10-2月 -14 通道 C1: 启动全部数据文件备份集 通道 C1: 正在指定备份集中的数据文件 输入数据文件 fno=00001 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\SYSTEM01.DBF 输入数据文件 fno=00003 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\SYSAUX01.DBF 输入数据文件 fno=00005 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\EXAMPLE01.DBF 输入数据文件 fno=00006 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\ZWC.DBF 输入数据文件 fno=00002 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\UNDOTBS01.DBF 输入数据文件 fno=00004 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\USERS01.DBF 通道 C1: 正在启动段 1 于 10-2月 -14 通道 C1: 已完成段 1 于 10-2月 -14 段句柄=C:\BAK\20140210_16_1_BAK_DATA 标记=TAG20140210T215842 注释=NONE 通道 C1: 备份集已完成, 经过时间:00:00:07 通道 C1: 启动全部数据文件备份集 通道 C1: 正在指定备份集中的数据文件 备份集中包括当前控制文件 在备份集中包含当前的 SPFILE 通道 C1: 正在启动段 1 于 10-2月 -14 通道 C1: 已完成段 1 于 10-2月 -14 段句柄=C:\BAK\20140210_17_1_BAK_DATA 标记=TAG20140210T215842 注释=NONE 通道 C1: 备份集已完成, 经过时间:00:00:02 完成 backup 于 10-2月 -14 启动 backup 于 10-2月 -14 当前日志已存档 通道 C1: 正在启动存档日志备份集 通道 C1: 正在指定备份集中的存档日志 输入存档日志线程 =1 序列 =19 记录 ID=18 时间戳=839195922 输入存档日志线程 =1 序列 =20 记录 ID=19 时间戳=839195932 通道 C1: 正在启动段 1 于 10-2月 -14 通道 C1: 已完成段 1 于 10-2月 -14 段句柄=C:\BAK\20140210_18_1_BAK_ARC 标记=TAG20140210T215852 注释=NONE 通道 C1: 备份集已完成, 经过时间:00:00:02 通道 C1: 正在删除存档日志 存档日志文件名 =C:\ARCH\ARC00019_0839181856.001 记录 ID=18 时间戳 =839195922 存档日志文件名 =C:\ARCH\ARC00020_0839181856.001 记录 ID=19 时间戳 =839195932 完成 backup 于 10-2月 -14 启动 backup 于 10-2月 -14 通道 C1: 启动全部数据文件备份集 通道 C1: 正在指定备份集中的数据文件 备份集中包括当前控制文件 通道 C1: 正在启动段 1 于 10-2月 -14 通道 C1: 已完成段 1 于 10-2月 -14 段句柄=C:\BAK\0JP0A78U_1_1_BAK_CTL 标记=TAG20140210T215854 注释=NONE 通道 C1: 备份集已完成, 经过时间:00:00:01 完成 backup 于 10-2月 -14 释放的通道: C1 RMAN>
SQL> create pfile from spfile; 文件已创建。 SQL> show parameter spfile; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string C:\ORACLE\PRODUCT\10.2.0\DB_1\ DATABASE\SPFILEORCL.ORA 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\dbserver\adump' *.background_dump_dest='C:\oracle\product\10.2.0\admin\dbserver\bdump' *.compatible='10.2.0.3.0' *.control_files='C:\oracle\product\10.2.0\oradata\dbserver\control01.ctl','C:\oracle\product\10.2.0\oradata\dbserver\control02.ctl','C:\oracle\product\10.2.0\oradata\dbserver\control03.ctl' *.core_dump_dest='C:\oracle\product\10.2.0\admin\dbserver\cdump' *.db_block_size=8192 *.db_domain='' *.db_file_multiblock_read_count=16 *.db_name='dbserver' *.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' *.job_queue_processes=10 *.log_archive_dest_1='LOCATION=c:\arch' *.log_archive_format='ARC%S_%R.%T' *.nls_language='SIMPLIFIED CHINESE' *.nls_territory='CHINA' *.open_cursors=300 *.pga_aggregate_target=203423744 *.processes=500 *.remote_login_passwordfile='EXCLUSIVE' *.sessions=555 *.sga_target=612368384 *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' *.user_dump_dest='C:\oracle\product\10.2.0\admin\dbserver\udump'将修改后的pfile传到Linux端
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='/u01/app/oracle/admin/dbserver/adump' *.background_dump_dest='/u01/app/oracle/admin/dbserver/bdump' *.compatible='10.2.0.3.0' *.control_files='/u01/app/oracle/oradata/dbserver/control01.ctl','/u01/app/oracle/oradata/dbserver/control02.ctl','/u01/app/oracle/oradata/dbserver/control03.ctl' *.core_dump_dest='/u01/app/oracle/admin/dbserver/cdump' *.db_block_size=8192 *.db_domain='' *.db_file_multiblock_read_count=16 *.db_name='dbserver' *.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' *.job_queue_processes=10 *.log_archive_dest_1='LOCATION=/arch' *.log_archive_format='ARC%S_%R.%T' *.nls_language='SIMPLIFIED CHINESE' *.nls_territory='CHINA' *.open_cursors=300 *.pga_aggregate_target=203423744 *.processes=500 *.remote_login_passwordfile='EXCLUSIVE' *.sessions=555 *.sga_target=612368384 *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' *.user_dump_dest='/u01/app/oracle/admin/dbserver/udump'
[oracle@vzwc bak]$ rman target / Recovery Manager: Release 10.2.0.4.0 - Production on Mon Feb 10 22:22:16 2014 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database (not started) RMAN> set dbid=66428446 executing command: SET DBID RMAN> startup nomount pfile='/bak/initorcl.ora' Oracle instance started Total System Global Area 612368384 bytes Fixed Size 2085872 bytes Variable Size 167775248 bytes Database Buffers 436207616 bytes Redo Buffers 6299648 bytes RMAN>
RMAN> restore controlfile from '/bak/0JP0A78U_1_1_BAK_CTL'; Starting restore at 10-FEB-14 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=540 devtype=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 output filename=/u01/app/oracle/oradata/dbserver/control01.ctl output filename=/u01/app/oracle/oradata/dbserver/control02.ctl output filename=/u01/app/oracle/oradata/dbserver/control03.ctl Finished restore at 10-FEB-14 RMAN> alter database mount; database mounted released channel: ORA_DISK_1
RMAN> catalog start with '/bak/'; searching for all files that match the pattern /bak/ List of Files Unknown to the Database ===================================== File Name: /bak/20140210_18_1_BAK_ARC File Name: /bak/0JP0A78U_1_1_BAK_CTL File Name: /bak/20140210_17_1_BAK_DATA File Name: /bak/20140210_16_1_BAK_DATA File Name: /bak/initorcl.ora Do you really want to catalog the above files (enter YES or NO)? YES cataloging files... cataloging done List of Cataloged Files ======================= File Name: /bak/20140210_18_1_BAK_ARC File Name: /bak/0JP0A78U_1_1_BAK_CTL File Name: /bak/20140210_17_1_BAK_DATA File Name: /bak/20140210_16_1_BAK_DATA List of Files Which Where Not Cataloged ======================================= File Name: /bak/initorcl.ora RMAN-07517: Reason: The file header is corrupted RMAN>
RMAN> list backup; List of Backup Sets =================== BS Key Type LV Size ------- ---- -- ---------- 10 Full 710.09M List of Datafiles in backup set 10 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 644266 10-FEB-14 C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\SYSTEM01.DBF 2 Full 644266 10-FEB-14 C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\UNDOTBS01.DBF 3 Full 644266 10-FEB-14 C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\SYSAUX01.DBF 4 Full 644266 10-FEB-14 C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\USERS01.DBF 5 Full 644266 10-FEB-14 C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\EXAMPLE01.DBF 6 Full 644266 10-FEB-14 C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\ZWC.DBF Backup Set Copy #1 of backup set 10 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:04 10-FEB-14 NO TAG20140210T215842 List of Backup Pieces for backup set 10 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 10 1 AVAILABLE C:\BAK\20140210_16_1_BAK_DATA Backup Set Copy #2 of backup set 10 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:04 10-FEB-14 NO TAG20140210T215842 List of Backup Pieces for backup set 10 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 16 1 AVAILABLE /bak/20140210_16_1_BAK_DATA BS Key Type LV Size ------- ---- -- ---------- 11 Full 6.80M Control File Included: Ckp SCN: 644268 Ckp time: 10-FEB-14 SPFILE Included: Modification time: 10-FEB-14 Backup Set Copy #1 of backup set 11 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:02 10-FEB-14 NO TAG20140210T215842 List of Backup Pieces for backup set 11 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 11 1 AVAILABLE C:\BAK\20140210_17_1_BAK_DATA Backup Set Copy #2 of backup set 11 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:02 10-FEB-14 NO TAG20140210T215842 List of Backup Pieces for backup set 11 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 15 1 AVAILABLE /bak/20140210_17_1_BAK_DATA BS Key Size ------- ---------- 12 2.50K List of Archived Logs in backup set 12 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 19 644196 10-FEB-14 644256 10-FEB-14 1 20 644256 10-FEB-14 644274 10-FEB-14 Backup Set Copy #1 of backup set 12 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:01 10-FEB-14 NO TAG20140210T215852 List of Backup Pieces for backup set 12 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 12 1 AVAILABLE C:\BAK\20140210_18_1_BAK_ARC Backup Set Copy #2 of backup set 12 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:01 10-FEB-14 NO TAG20140210T215852 List of Backup Pieces for backup set 12 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 13 1 AVAILABLE /bak/20140210_18_1_BAK_ARC BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 13 Full 6.77M DISK 00:00:00 10-FEB-14 BP Key: 14 Status: AVAILABLE Compressed: NO Tag: TAG20140210T215854 Piece Name: /bak/0JP0A78U_1_1_BAK_CTL Control File Included: Ckp SCN: 644281 Ckp time: 10-FEB-14 RMAN>
RMAN> run{ 2> allocate channel c1 type disk; 3> set newname for datafile 1 to '/u01/app/oracle/oradata/dbserver/system01.dbf'; 4> set newname for datafile 2 to '/u01/app/oracle/oradata/dbserver/undotbs01.dbf'; set newname for datafile 3 to '/u01/app/oracle/oradata/dbserver/sysaux01.dbf'; set newname for datafile 4 to '/u01/app/oracle/oradata/dbserver/users01.dbf'; set newname for datafile 5 to '/u01/app/oracle/oradata/dbserver/example01.dbf'; set newname for datafile 6 to '/u01/app/oracle/oradata/dbserver/zwc.dbf'; 9> restore database; 10> switch datafile all; 11> release channel c1; 12> } allocated channel: c1 channel c1: sid=540 devtype=DISK executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 10-FEB-14 channel c1: restoring datafile 00006 input datafile copy recid=5 stamp=839198158 filename=/u01/app/oracle/product/10.2.0/db_1/dbs/C:ORACLEPRODUCT10.2.0ORADATADBSERVERZWC.DBF destination for restore of datafile 00006: /u01/app/oracle/oradata/dbserver/zwc.dbf channel c1: copied datafile copy of datafile 00006 output filename=/u01/app/oracle/oradata/dbserver/zwc.dbf recid=13 stamp=839198270 channel c1: starting datafile backupset restore channel c1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u01/app/oracle/oradata/dbserver/system01.dbf restoring datafile 00002 to /u01/app/oracle/oradata/dbserver/undotbs01.dbf restoring datafile 00003 to /u01/app/oracle/oradata/dbserver/sysaux01.dbf restoring datafile 00004 to /u01/app/oracle/oradata/dbserver/users01.dbf restoring datafile 00005 to /u01/app/oracle/oradata/dbserver/example01.dbf channel c1: reading from backup piece C:\BAK\20140210_16_1_BAK_DATA channel c1: restored backup piece 1 failover to piece handle=/bak/20140210_16_1_BAK_DATA tag=TAG20140210T215842 channel c1: restore complete, elapsed time: 00:00:25 Finished restore at 10-FEB-14 datafile 1 switched to datafile copy input datafile copy recid=19 stamp=839198299 filename=/u01/app/oracle/oradata/dbserver/system01.dbf datafile 2 switched to datafile copy input datafile copy recid=20 stamp=839198299 filename=/u01/app/oracle/oradata/dbserver/undotbs01.dbf datafile 3 switched to datafile copy input datafile copy recid=21 stamp=839198299 filename=/u01/app/oracle/oradata/dbserver/sysaux01.dbf datafile 4 switched to datafile copy input datafile copy recid=22 stamp=839198299 filename=/u01/app/oracle/oradata/dbserver/users01.dbf datafile 5 switched to datafile copy input datafile copy recid=23 stamp=839198299 filename=/u01/app/oracle/oradata/dbserver/example01.dbf datafile 6 switched to datafile copy input datafile copy recid=24 stamp=839198299 filename=/u01/app/oracle/oradata/dbserver/zwc.dbf released channel: c1 RMAN>
RMAN> recover database; Starting recover at 10-FEB-14 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=540 devtype=DISK starting media recovery channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=20 channel ORA_DISK_1: reading from backup piece C:\BAK\20140210_18_1_BAK_ARC channel ORA_DISK_1: restored backup piece 1 failover to piece handle=/bak/20140210_18_1_BAK_ARC tag=TAG20140210T215852 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 archive log filename=/arch/ARC0000000020_0839181856.0001 thread=1 sequence=20 unable to find archive log archive log thread=1 sequence=21 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 02/10/2014 22:40:08 RMAN-06054: media recovery requesting unknown log: thread 1 seq 21 lowscn 644274 RMAN>
提示介质恢复到一个未知的SCN,可以使用set until scn或者set until time解决
查看源端windows的sequence#
[oracle@vzwc ~]$ sqlplus sys/[email protected]:1521/dbserver as sysdba SQL*Plus: Release 10.2.0.4.0 - Production on Mon Feb 10 22:42:56 2014 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 sequence# from v$archived_log; SEQUENCE# ---------- 2 3 4 5 6 7 8 9 10 11 12 SEQUENCE# ---------- 13 14 15 16 17 18 19 20 19 rows selected. SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination c:\arch Oldest online log sequence 19 Next log sequence to archive 21 Current log sequence 21
RMAN> run{ 2> set until sequence 21; 3> recover database; 4> } executing command: SET until clause Starting recover at 10-FEB-14 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:01 Finished recover at 10-FEB-14 RMAN>
SQL> alter database open resetlogs migrate;
SQL> @?/rdbms/admin/utlirp.sql
SQL> @?/rdbms/admin/utlrp.sql
SQL> shutdown immediate;
SQL> startup
open数据库resetlogs
RMAN> alter database open resetlogs; database opened
SQL> select member from v$logfile; MEMBER ---------------------------------------------------------------------------------------------------- /u01/app/oracle/product/10.2.0/db_1/dbs/C:ORACLEPRODUCT10.2.0ORADATADBSERVERREDO03.LOG /u01/app/oracle/product/10.2.0/db_1/dbs/C:ORACLEPRODUCT10.2.0ORADATADBSERVERREDO02.LOG /u01/app/oracle/product/10.2.0/db_1/dbs/C:ORACLEPRODUCT10.2.0ORADATADBSERVERREDO01.LOG SQL> select group#,sequence#,bytes/1024/1024,members,status from v$log; GROUP# SEQUENCE# BYTES/1024/1024 MEMBERS STATUS ---------- ---------- --------------- ---------- ---------------- 1 1 50 1 CURRENT 2 0 50 1 UNUSED 3 0 50 1 UNUSED SQL> alter database drop logfile group 2; Database altered. SQL> alter database add logfile group 2('/u01/app/oracle/oradata/dbserver/redo02.log') size 50M; Database altered. SQL> alter database drop logfile group 3; Database altered. SQL> alter database add logfile group 3('/u01/app/oracle/oradata/dbserver/redo03.log') size 50M; Database altered. SQL> alter system switch logfile; System altered. SQL> alter database drop logfile group 1; Database altered. SQL> alter database add logfile group 1('/u01/app/oracle/oradata/dbserver/redo01.log') size 50M; Database altered. SQL> select a.group#,a.bytes/1024/1024,a.members,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#; GROUP# A.BYTES/1024/1024 MEMBERS STATUS MEMBER ---------- ----------------- ---------- ---------------- -------------------------------------------------------------------------------- 3 50 1 INACTIVE /u01/app/oracle/oradata/dbserver/redo03.log 2 50 1 CURRENT /u01/app/oracle/oradata/dbserver/redo02.log 1 50 1 UNUSED /u01/app/oracle/oradata/dbserver/redo01.log
SQL> select name from v$tempfile; NAME ------------------------------------------------------------------------------------------------------------------------------- C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBSERVER\TEMP01.DBF SQL> create temporary tablespace temptbs tempfile '/u01/app/oracle/oradata/dbserver/temptbs01.dbf' size 100M autoextend on; Tablespace created. SQL> alter database default temporary tablespace temptbs; Database altered. SQL> drop tablespace temp including contents and datafiles; Tablespace dropped. SQL> select name from v$tempfile; NAME -------------------------------------------------------------------------------------------------------------------------------- /u01/app/oracle/oradata/dbserver/temptbs01.dbf SQL>
SQL> show parameter spfile NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string SQL> SQL> SQL> create spfile from pfile='/bak/initorcl.ora'; File created. SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 612368384 bytes Fixed Size 2085872 bytes Variable Size 167775248 bytes Database Buffers 436207616 bytes Redo Buffers 6299648 bytes Database mounted. Database opened. SQL> show parameter spfile NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string /u01/app/oracle/product/10.2.0 /db_1/dbs/spfileORCL.ora SQL>
[oracle@vzwc admin]$ cat listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = dbserver) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (SID_NAME = ORCL) ) ) LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vzwc)(PORT = 1521)) ) [oracle@vzwc admin]$ cat tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. DBSERVER = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.7)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = dbserver) ) ) [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ lsnrctl start LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 10-FEB-2014 23:18:27 Copyright (c) 1991, 2007, Oracle. All rights reserved. Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.4.0 - Production System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vzwc)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vzwc)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production Start Date 10-FEB-2014 23:18:28 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vzwc)(PORT=1521))) Services Summary... Service "dbserver" has 1 instance(s). Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ lsnrctl status LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 10-FEB-2014 23:19:00 Copyright (c) 1991, 2007, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vzwc)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production Start Date 10-FEB-2014 23:18:28 Uptime 0 days 0 hr. 0 min. 32 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vzwc)(PORT=1521))) Services Summary... Service "ORCLXDB" has 1 instance(s). Instance "ORCL", status READY, has 1 handler(s) for this service... Service "dbserver" has 2 instance(s). Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service... Instance "ORCL", status READY, has 1 handler(s) for this service... Service "dbserver_XPT" has 1 instance(s). Instance "ORCL", status READY, has 1 handler(s) for this service... The command completed successfully [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ [oracle@vzwc admin]$ lsnrctl service LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 10-FEB-2014 23:19:09 Copyright (c) 1991, 2007, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vzwc)(PORT=1521))) Services Summary... Service "ORCLXDB" has 1 instance(s). Instance "ORCL", status READY, has 1 handler(s) for this service... Handler(s): "D000" established:0 refused:0 current:0 max:1022 state:ready DISPATCHER <machine: vzwc, pid: 15599> (ADDRESS=(PROTOCOL=tcp)(HOST=vzwc)(PORT=47521)) Service "dbserver" has 2 instance(s). Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 LOCAL SERVER Instance "ORCL", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "dbserver_XPT" has 1 instance(s). Instance "ORCL", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER The command completed successfully
[oracle@vzwc admin]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.4.0 - Production on Mon Feb 10 23:19:43 2014 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> show parameter _name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string db_name string dbserver db_unique_name string dbserver global_names boolean FALSE instance_name string ORCL lock_name_space string log_file_name_convert string service_names string dbserver SQL> SQL> conn zwc@dbserver Enter password: Connected. SQL> select tname from tab; TNAME ------------------------------ TAB01 SQL> select * from tab01 where rownum=1; OWNER ------------------------------ OBJECT_NAME -------------------------------------------------------------------------------- SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE ------------------------------ ---------- -------------- ------------------- CREATED LAST_DDL_TIM TIMESTAMP STATUS T G S ------------ ------------ ------------------- ------- - - - SYS ICOL$ 20 2 TABLE 08-MAY-08 08-MAY-08 2008-05-08:00:53:58 VALID N N N SQL> select count(*) from tab01; select count(*) from tab01 * ERROR at line 1: ORA-01578: ORACLE data block corrupted (file # 6, block # 1129) ORA-01110: data file 6: '/u01/app/oracle/oradata/dbserver/zwc.dbf'
[oracle@vzwc ~]$ dbv file=/u01/app/oracle/oradata/dbserver/zwc.dbf DBVERIFY: Release 10.2.0.4.0 - Production on Mon Feb 10 23:24:05 2014 Copyright (c) 1982, 2007, Oracle. All rights reserved. DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/dbserver/zwc.dbf DBV-00200: Block, DBA 25166953, already marked corrupt DBV-00200: Block, DBA 25166956, already marked corrupt DBVERIFY - Verification complete Total Pages Examined : 12800 Total Pages Processed (Data) : 12137 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 0 Total Pages Failing (Index): 0 Total Pages Processed (Other): 662 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 1 Total Pages Marked Corrupt : 2 Total Pages Influx : 0 Highest block SCN : 639878 (0.639878)
SQL> l 1 select name from v$datafile 2 union all 3 select name from v$tempfile 4 union all 5 select name from v$controlfile 6 union all 7* select member from v$logfile SQL> / NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/dbserver/system01.dbf /u01/app/oracle/oradata/dbserver/undotbs01.dbf /u01/app/oracle/oradata/dbserver/sysaux01.dbf /u01/app/oracle/oradata/dbserver/users01.dbf /u01/app/oracle/oradata/dbserver/example01.dbf /u01/app/oracle/oradata/dbserver/zwc.dbf /u01/app/oracle/oradata/dbserver/temptbs01.dbf /u01/app/oracle/oradata/dbserver/control01.ctl /u01/app/oracle/oradata/dbserver/control02.ctl /u01/app/oracle/oradata/dbserver/control03.ctl /u01/app/oracle/oradata/dbserver/redo03.log /u01/app/oracle/oradata/dbserver/redo02.log /u01/app/oracle/oradata/dbserver/redo01.log 13 rows selected. SQL>