[oracle@liu dbs]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 10.2.0.1.0 – Production on Wed Dec 7 00:06:50 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

SQL> create table t as select * from dba_segments; —–创建测试表 t

Table created.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
———- ———- ———- ———- ———- — —————- ————- ———
1 1 27 52428800 1 NO CURRENT 782969 06-DEC-11
2 1 24 52428800 1 YES INACTIVE 696233 02-DEC-11
3 1 25 52428800 1 YES INACTIVE 696534 04-DEC-11
10 1 26 52428800 1 YES INACTIVE 749727 06-DEC-11

[oracle@liu liu]$ echo “my sql” > redo01.log
[oracle@liu liu]$
[oracle@liu liu]$

SQL> shutdown abort;————-直接 shutdown abort 模拟crash
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 218103808 bytes
Fixed Size 1218580 bytes
Variable Size 75499500 bytes
Database Buffers 134217728 bytes
Redo Buffers 7168000 bytes
Database mounted.
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/liu/redo01.log’
ORA-27046: file size is not a multiple of logical block size
Additional information: 1

SQL> create pfile from spfile;

File created.

SQL> !

[oracle@liu dbs]$ vi initliu.ora

liu.__db_cache_size=134217728
liu.__java_pool_size=4194304
liu.__large_pool_size=4194304
liu.__shared_pool_size=67108864
liu.__streams_pool_size=0
*.audit_file_dest=’/u01/app/oracle/admin/liu/adump’
*.background_dump_dest=’/u01/app/oracle/admin/liu/bdump’
*.compatible=’10.2.0.1.0′
*.control_files=’/u01/app/oracle/oradata/liu/control01.ctl’,’/u01/app/oracle/oradata/liu/control02.ctl’,’/u01/app/oracle/oradata/liu/control03.ctl’
*.core_dump_dest=’/u01/app/oracle/admin/liu/cdump’
*.db_block_size=8192
*.db_domain=”
*.db_file_multiblock_read_count=16
*.db_name=’liu’
*.db_recovery_file_dest=’/u01/app/oracle/flash_recovery_area’
*.db_recovery_file_dest_size=2147483648
*.db_unique_name=’liu’
*.dispatchers='(PROTOCOL=TCP) (SERVICE=liuXDB)’
*.fal_client=’liu’
*.fal_server=’standby’
*.job_queue_processes=10
*.log_archive_config=’DG_CONFIG=(liu,standby)’
*.log_archive_dest_1=’location=/u01/arch/ valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=liu’
*.log_archive_dest_2=’service=standby lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=standby’
*.log_archive_format=’%t_%s_%r.dbf’
*.open_cursors=300
*.pga_aggregate_target=71303168
*.processes=300
*.remote_login_passwordfile=’EXCLUSIVE’
*.sessions=335
*.sga_target=216006656
*.standby_file_management=’auto’
*.undo_management=’AUTO’
*.undo_tablespace=’UNDOTBS1′
*.user_dump_dest=’/u01/app/oracle/admin/liu/udump’
*._allow_resetlogs_corruption=TRUE
*._allow_error_simulation=TRUE

[oracle@liu dbs]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Dec 6 23:57:41 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

SQL> shutdown abort;
ORACLE instance shut down.
SQL> create spfile from pfile;

File created.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 218103808 bytes
Fixed Size 1218580 bytes
Variable Size 75499500 bytes
Database Buffers 134217728 bytes
Redo Buffers 7168000 bytes
SQL> alter database mount;

Database altered.

SQL> show parameter all

NAME TYPE VALUE
———————————— ———– ——————————
_allow_error_simulation boolean TRUE
_allow_resetlogs_corruption boolean TRUE
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE
parallel_execution_message_size integer 2148
parallel_instance_group string
parallel_max_servers integer 40
parallel_min_percent integer 0
parallel_min_servers integer 0
parallel_server boolean FALSE

NAME TYPE VALUE
———————————— ———– ——————————
parallel_server_instances integer 1
parallel_threads_per_cpu integer 2
recovery_parallelism integer 0
SQL> recover database
ORA-00283: recovery session canceled due to errors
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/liu/redo01.log’
ORA-27046: file size is not a multiple of logical block size
Additional information: 1

SQL> recover database until cancel;
ORA-00279: change 782970 generated at 12/06/2011 22:05:16 needed for thread 1
ORA-00289: suggestion : /u01/arch/1_27_767998669.dbf
ORA-00280: change 782970 for thread 1 is in sequence #27

Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log ‘/u01/arch/1_27_767998669.dbf’
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

ORA-00308: cannot open archived log ‘/u01/arch/1_27_767998669.dbf’
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: ‘/u01/app/oracle/oradata/liu/system01.dbf’

SQL>
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced

SQL> shutdown immediate;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn’t exist
SQL>
SQL>
SQL> startup;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn’t exist
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

[oracle@liu dbs]$ ps -ef |grep ora_
oracle 10245 10041 0 00:01 pts/3 00:00:00 grep ora_
[oracle@liu dbs]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 10.2.0.1.0 – Production on Wed Dec 7 00:01:43 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 218103808 bytes
Fixed Size 1218580 bytes
Variable Size 75499500 bytes
Database Buffers 134217728 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL>
SQL> set line 200
SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
———- ———- ———- ———- ———- — —————- ————- ———
1 1 1 52428800 1 YES INACTIVE 782971 07-DEC-11
2 1 2 52428800 1 YES INACTIVE 782972 07-DEC-11
3 1 3 52428800 1 NO CURRENT 802977 07-DEC-11
10 1 0 52428800 1 YES UNUSED 0

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
———- ———- ———- ———- ———- — —————- ————- ———
1 1 5 52428800 1 YES INACTIVE 803877 07-DEC-11
2 1 6 52428800 1 YES INACTIVE 803879 07-DEC-11
3 1 7 52428800 1 NO CURRENT 803882 07-DEC-11
10 1 4 52428800 1 YES INACTIVE 803875 07-DEC-11

SQL> alter system switch logfile;

System altered.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
———- ———- ———- ———- ———- — —————- ————- ———
1 1 5 52428800 1 YES INACTIVE 803877 07-DEC-11
2 1 6 52428800 1 YES INACTIVE 803879 07-DEC-11
3 1 7 52428800 1 YES INACTIVE 803882 07-DEC-11
10 1 8 52428800 1 NO CURRENT 803887 07-DEC-11

SQL> alter system switch logfile;

System altered.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
———- ———- ———- ———- ———- — —————- ————- ———
1 1 9 52428800 1 NO CURRENT 803893 07-DEC-11
2 1 6 52428800 1 YES INACTIVE 803879 07-DEC-11
3 1 7 52428800 1 YES INACTIVE 803882 07-DEC-11
10 1 8 52428800 1 YES INACTIVE 803887 07-DEC-11

SQL> shutdown immediate;
dDatabase closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup;
ORACLE instance started.

Total System Global Area 218103808 bytes
Fixed Size 1218580 bytes
Variable Size 75499500 bytes
Database Buffers 134217728 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL> desc t;
ERROR:
ORA-04043: object t does not exist

看到虽然open了database 但是redo01.log 中的记录也将丢失