OFFLINE不同选项的测试(NORMAL,TEMPORARY,IMMEDIATE)(一)

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     2
Next log sequence to archive   4
Current log sequence           4
SQL> alter system switch logfile;

System altered.

SQL> create table t(scn int) tablespace users;

Table created.

SQL> insert into t select dbms_flashback.get_system_change_Number from dba_objects where rownum<=1000;

1000 rows created.

SQL> commit;

Commit complete.

SQL> select max(scn),min(scn) from t;

  MAX(SCN)   MIN(SCN)
---------- ----------
    658591     658591

SQL> select change# from v$instance;
select change# from v$instance
       *
ERROR at line 1:
ORA-00904: "CHANGE#": invalid identifier


SQL> insert into t select dbms_flashback.get_system_change_number from dba_objects where rownum<1000;

999 rows created.

SQL> insert into t select dbms_flashback.get_system_change_number from dba_objects where rownum<2;

1 row created.

SQL> select distinct scn,count(*) from t group by scn;

       SCN   COUNT(*)
---------- ----------
    659277          1
    658591       1000
    659275        999

SQL>  insert into t select dbms_flashback.get_system_change_number from t;

2000 rows created.

SQL> select distinct scn,count(*)  from t group by scn;

       SCN   COUNT(*)
---------- ----------
    659277          1
    658591       1000
    659275        999
    659295        469
    659293       1531

SQL> commit;

Commit complete.

SQL> select group#,bytes,archived,first_change#,sequence#,status from v$log;

    GROUP#      BYTES ARC FIRST_CHANGE#  SEQUENCE# STATUS
---------- ---------- --- ------------- ---------- ----------------
         1   52428800 YES        637009          4 INACTIVE
         2   52428800 NO         658540          5 CURRENT
         3   52428800 YES        614226          3 INACTIVE

SQL>
SQL>
SQL> alter system checkpoint;

System altered.

SQL> select substr(name,1,40) dname,checkpoint_change#,last_change#,offline_change#,status from v$datafile;

DNAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS
------------------ ------------ --------------- -------
/u01/oradata/orac10g21/system01.dbf
            659333                       602446 SYSTEM

/u01/oradata/orac10g21/undotbs01.dbf
            659333                       602446 ONLINE

/u01/oradata/orac10g21/sysaux01.dbf
            659333                       602446 ONLINE


DNAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS
------------------ ------------ --------------- -------
/u01/oradata/orac10g21/users01.dbf
            659333                       602446 ONLINE

/u01/oradata/orac10g21/example01.dbf
            659333                       602446 ONLINE

/u01/oradata/orac10g21/testing_lmt.dbf
            659333                            0 ONLINE


DNAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS
------------------ ------------ --------------- -------
/u01/oradata/orac10g21/tbs_test_01.dbf
            659333                            0 ONLINE

/u01/oradata/orac10g21/tbs_test_02.dbf
            659333                            0 ONLINE

/u01/oradata/orac10g21/tbs_test_03.dbf
            659333                            0 ONLINE


9 rows selected.

                                                                                                                                                                                              
SQL> set linesize 2000
SQL> select substr(name,1,40) dname,checkpoint_change#,last_change#,offline_change#,status from v$datafile;

DNAME                                                                            CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS
-------------------------------------------------------------------------------- ------------------ ------------ --------------- -------
/u01/oradata/orac10g21/system01.dbf                                                          659333                       602446 SYSTEM
/u01/oradata/orac10g21/undotbs01.dbf                                                         659333                       602446 ONLINE
/u01/oradata/orac10g21/sysaux01.dbf                                                          659333                       602446 ONLINE
/u01/oradata/orac10g21/users01.dbf                                                           659333                       602446 ONLINE
/u01/oradata/orac10g21/example01.dbf                                                         659333                       602446 ONLINE
/u01/oradata/orac10g21/testing_lmt.dbf                                                       659333                            0 ONLINE
/u01/oradata/orac10g21/tbs_test_01.dbf                                                       659333                            0 ONLINE
/u01/oradata/orac10g21/tbs_test_02.dbf                                                       659333                            0 ONLINE
/u01/oradata/orac10g21/tbs_test_03.dbf                                                       659333                            0 ONLINE

9 rows selected.

SQL> select name from v$datafile;

NAME
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/oradata/orac10g21/system01.dbf
/u01/oradata/orac10g21/undotbs01.dbf
/u01/oradata/orac10g21/sysaux01.dbf
/u01/oradata/orac10g21/users01.dbf
/u01/oradata/orac10g21/example01.dbf
/u01/oradata/orac10g21/testing_lmt.dbf
/u01/oradata/orac10g21/tbs_test_01.dbf
/u01/oradata/orac10g21/tbs_test_02.dbf
/u01/oradata/orac10g21/tbs_test_03.dbf

9 rows selected.

SQL> alter tablespace users add datafile '/u01/oradata/orac10g21/users02.dbf' size 10m;

Tablespace altered.

SQL> select substr(name,1,40) dname,checkpoint_change#,last_change#,offline_change#,status from v$datafile;

DNAME                                                                            CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# STATUS
-------------------------------------------------------------------------------- ------------------ ------------ --------------- -------
/u01/oradata/orac10g21/system01.dbf                                                          659333                       602446 SYSTEM
/u01/oradata/orac10g21/undotbs01.dbf                                                         659333                       602446 ONLINE
/u01/oradata/orac10g21/sysaux01.dbf                                                          659333                       602446 ONLINE
/u01/oradata/orac10g21/users01.dbf                                                           659333                       602446 ONLINE
/u01/oradata/orac10g21/example01.dbf                                                         659333                       602446 ONLINE
/u01/oradata/orac10g21/testing_lmt.dbf                                                       659333                            0 ONLINE
/u01/oradata/orac10g21/tbs_test_01.dbf                                                       659333                            0 ONLINE
/u01/oradata/orac10g21/tbs_test_02.dbf                                                       659333                            0 ONLINE
/u01/oradata/orac10g21/tbs_test_03.dbf                                                       659333                            0 ONLINE
/u01/oradata/orac10g21/users02.dbf                                                           659640                            0 ONLINE

10 rows selected.

SQL>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值