Oracle ADG备库新增变为一主多从

oracleADG增加备库

新增备库主机:

192.168.66.44

主机名:dgd

sid:orcl

网络别名:orcl_sd

下文中称之为“备2”

1,更改现在的主备文件

hosts文件,tnsnames.ora文件,initorcl.ora文件

1.1,更改hosts文件

把新增的主机加上

主:

 
[oracle@db dbs]$ cat /etc/hosts
 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 192.168.66.61 db
 192.168.66.62 dg
 192.168.66.64 dgd

备1:

[oracle@dg dbs]$ cat /etc/hosts
 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 192.168.66.61 db
 192.168.66.62 dg
 192.168.66.64 dgd

 

备2:

 [oracle@dgd ~]$ cat /etc/hosts
 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 192.168.66.61 db
 192.168.66.62 dg
 192.168.66.64 dgd
 ​

 

1.2,修改tnsnames.ora文件

主:

#增加下面内容
 [oracle@db admin]$ vim tnsnames.ora
 orcl_sd =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = dgd)(PORT = 1521))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = orcl)
          (SERVER = DEDICATED)
      )
  )
 ​

 

备1:

#增加下面内容
 [oracle@dg admin]$ vim tnsnames.ora 
 orcl_sd =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = dgd)(PORT = 1521))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = orcl)
          (SERVER = DEDICATED)
      )
  )

备3:

 
[oracle@dgd admin]$ cat tnsnames.ora
 # tnsnames.ora Network Configuration File: /data/app/oracle/product/11.2.0.4/db_1/network/admin/tnsnames.ora
  # Generated by Oracle configuration tools.
 ORCL =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dgd)(PORT = 1521))
      (CONNECT_DATA =
        (SERVER = DEDICATED)
        (SERVICE_NAME = orcl)
      )
    )
 orcl_pri =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = db)(PORT = 1521))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = orcl)
        (SERVER = DEDICATED)
      )
  )
 orcl_sty =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = dg)(PORT = 1521))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = orcl)
          (SERVER = DEDICATED)
      )
  )
 orcl_sd =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = dgd)(PORT = 1521))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = orcl)
          (SERVER = DEDICATED)
      )
  )

 

1.3,修改pfile文件

主:

 
#修改和增加了以下内容
 [oracle@db dbs]$ pwd
 /data/app/oracle/product/11.2.0.4/db_1/dbs
 [oracle@db dbs]$ vim initorcl.ora
 *.log_archive_config='dg_config=(orcl_pri,orcl_sty,orcl_sd)'
 *.log_archive_dest_3='service=orcl_sd LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=orcl_sd'
 *.log_archive_dest_state_3='ENABLE'
 *.fal_server='orcl_sty,orcl_sd'
 *.db_file_name_convert='/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/'
 *.log_file_name_convert='/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/'

 

备1:

#修改和增加了以下内容
 [oracle@dg dbs]$ pwd
 /data/app/oracle/product/11.2.0.4/db_1/dbs
 [oracle@dg dbs]$ vim initorcl_sty.ora
 *.fal_server='orcl_pri,orcl_sd'
 *.log_archive_config='dg_config=(orcl_pri,orcl_sty,orcl_sd)'
 *.log_archive_dest_3='service=orcl_sd LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=orcl_sd'
 *.log_archive_dest_state_3='ENABLE'
 *.log_file_name_convert='/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/'
 *.db_file_name_convert='/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/'

 

备2:

#可以把备1的pfile文件传到备2上然后进行修改
备1:
[oracle@dg dbs]$ scp initorcl_sty.ora oracle@dgd:$ORACLE_HOME/dbs/
备2:
[oracle@dgd dbs]$ mv initorcl_sty.ora initorcl_sd.ora
[oracle@dgd dbs]$ cat initorcl_sd.ora 
orcl_sd.__db_cache_size=5586812928
orcl_sd.__java_pool_size=33554432
orcl_sd.__large_pool_size=603979776
orcl_sd.__oracle_base='/data/app/oracle'
orcl_sd.__pga_aggregate_target=2466250752
orcl_sd.__sga_target=7381975040
orcl_sd.__shared_io_pool_size=0
orcl_sd.__shared_pool_size=1107296256
orcl_sd.__streams_pool_size=0
*.audit_file_dest='/data/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/data/app/oracle/oradata/orcl/control01.ctl','/data/app/oracle/fast_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_name_convert='/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/'
*.db_files=2000
*.db_name='orcl'
*.db_recovery_file_dest='/data/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=53687091200
*.db_unique_name='orcl_sd'
*.diagnostic_dest='/data/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.fal_client='orcl_sd'
*.fal_server='orcl_pri,orcl_sty'
*.log_archive_config='dg_config=(orcl_pri,orcl_sty,orcl_sd)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=orcl_sd'
*.log_archive_dest_2='service=orcl_pri LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=orcl_pri'
*.log_archive_dest_3='service=orcl_sty LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=orcl_sty'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_dest_state_3='ENABLE'
*.log_file_name_convert='/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/','/data/app/oracle/oradata/orcl/'
*.open_cursors=300
*.pga_aggregate_target=2459959296
*.processes=1500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1500
*.sga_target=7379877888
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

 

1.4,在主库把数据备份及控制文件和主库密码拷贝到备库

主:

[oracle@db rman_backup]$ rman target /
RMAN> run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
backup database format '/data/app/rman_backup/FULL_%U.bak';
backup archivelog all format '/data/app/rman_backup/ARC_%U.bak';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
 }
 #查看备份的数据然后打包
[oracle@db rman_backup]$ ll
total 2810968
-rw-r----- 1 oracle oinstall 431243264 Jul  2 13:44 ARC_1ev4a2d1_1_1.bak
-rw-r----- 1 oracle oinstall 422628864 Jul  2 13:44 ARC_1fv4a2d1_1_1.bak
-rw-r----- 1 oracle oinstall 335458304 Jul  2 13:44 ARC_1gv4a2d1_1_1.bak
-rw-r----- 1 oracle oinstall 250349056 Jul  2 13:44 ARC_1hv4a2d1_1_1.bak
-rw-r----- 1 oracle oinstall 169233920 Jul  2 13:44 ARC_1iv4a2dg_1_1.bak
-rw-r----- 1 oracle oinstall 668098560 Jul  2 13:43 FULL_18v4a2ck_1_1.bak
-rw-r----- 1 oracle oinstall 587759616 Jul  2 13:43 FULL_19v4a2ck_1_1.bak
-rw-r----- 1 oracle oinstall   2285568 Jul  2 13:43 FULL_1av4a2ck_1_1.bak
-rw-r----- 1 oracle oinstall   9895936 Jul  2 13:43 FULL_1bv4a2cl_1_1.bak
-rw-r----- 1 oracle oinstall   1376256 Jul  2 13:43 FULL_1cv4a2cr_1_1.bak
-rw-r----- 1 oracle oinstall     98304 Jul  2 13:43 FULL_1dv4a2cu_1_1.bak
[oracle@db rman_backup]$ du -sh
2.7G    .
[oracle@db rman_backup]$ tar -zcvf rmanbak.tgz ./
./
./FULL_18v4a2ck_1_1.bak
./FULL_19v4a2ck_1_1.bak
./FULL_1av4a2ck_1_1.bak
./FULL_1bv4a2cl_1_1.bak
./FULL_1cv4a2cr_1_1.bak
./FULL_1dv4a2cu_1_1.bak
./ARC_1ev4a2d1_1_1.bak
./ARC_1fv4a2d1_1_1.bak
./ARC_1gv4a2d1_1_1.bak
./ARC_1hv4a2d1_1_1.bak
./ARC_1iv4a2dg_1_1.bak
tar: .: file changed as we read it
#拷贝密码文件到此目录
[oracle@db dbs]$ cp orapworcl /data/app/rman_backup/

 

---拷贝控制文件到rman_backup目录下
SQL> alter database create standby controlfile as '/data/app/rman_backup/standby.ctl';

Database altered.
备2:
#首先创建一个rman_backup目录
[oracle@dgd dbs]$ mkdir -p /data/app/rman_backup/
主:
#把数据文件及控制文件和密码传到备2
[oracle@db rman_backup]$ scp -p 12525 -l 100000 rmanbak.tgz standby.ctl orapworcl oracle@dgd:/data/app/rman_backup/

 

1.5,创建对应的目录

备2:

[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/admin/orcl/adump
p
[oracle@dgd dbs]$mkdir -p $ORACLE_BASE/admin/orcl_sty/cdump
[oracle@dgd dbs]$mkdir -p $ORACLE_BASE/diag/rdbms/orcl_sty/orcl_sty/trace
[oracle@dgd dbs]$mkdir -p $ORACLE_BASE/diag/rdbms/orcl_sty/orcl/trace
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/admin/orcl/dpdump
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/admin/orcl/cdump
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/diag/rdbms/orcl_pri/orcl/trace
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/admin/orcl_sty/adump
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/admin/orcl_sty/dpdump
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/admin/orcl_sty/cdump
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/diag/rdbms/orcl_sty/orcl_sty/trace
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/diag/rdbms/orcl_sty/orcl/trace
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/fast_recovery_area/
[oracle@dgd dbs]$ mkdir -p $ORACLE_BASE/oradata/orcl
[oracle@dgd dbs]$ cd /data/app/rman_backup/
[oracle@dgd rman_backup]$ mkdir -p /data/app/oracle/fast_recovery_area/orcl/
[oracle@dgd rman_backup]$ cp /data/app/rman_backup/standby.ctl /data/app/oracle/oradata/orcl/control01.ctl
[oracle@dgd rman_backup]$ cp /data/app/rman_backup/standby.ctl /data/app/oracle/fast_recovery_area/orcl/control02.ctl
[oracle@dgd rman_backup]$ cp orapworcl $OROACLE_HOME/dbs/

 

1.6,启动备2到nomount状态

使用初始化文件启动备库到nomount状态

备2:

SQL> startup pfile='/data/app/oracle/product/11.2.0.4/db_1/dbs/initorcl_sd.ora' nomount;
ORACLE instance started.

Total System Global Area 7349010432 bytes
Fixed Size            2267464 bytes
Variable Size         1728054968 bytes
Database Buffers     5603590144 bytes
Redo Buffers           15097856 bytes
SQL> create spfile from pfile='/data/app/oracle/product/11.2.0.4/db_1/dbs/initorcl_sd.ora';

File created.

 

1.8,备份恢复

[oracle@dgd rman_backup]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jul 2 13:58:52 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (not mounted)

RMAN> restore controlfile from '/data/app/oracle/oradata/orcl/control01.ctl';

Starting restore at 2020-07-02 13:59:05
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=572 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=/data/app/oracle/oradata/orcl/control01.ctl
output file name=/data/app/oracle/fast_recovery_area/orcl/control02.ctl
Finished restore at 2020-07-02 13:59:06

RMAN> exit

Recovery Manager complete.

 

1.9,切换备库2到mount状态

备2:

[oracle@dgd ~]$ sqlplus / as sysdba
SQL> alter database mount;

Database altered.

SQL> select status from v$instance;

STATUS
------------
MOUNTED
#解压备份数据
[oracle@dgd rman_backup]$ tar -zxf rmanbak.tgz 
[oracle@dgd rman_backup]$ mv rmanbak.tgz orapworcl standby.ctl /tmp/
#恢复数据
[oracle@dgd rman_backup]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jun 30 15:17:03 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1570902142, not open)

RMAN> catalog start with '/data/app/rman_backup/';

Starting implicit crosscheck backup at 2020-06-30 15:17:12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1141 device type=DISK
Crosschecked 18 objects
Finished implicit crosscheck backup at 2020-06-30 15:17:13

Starting implicit crosscheck copy at 2020-06-30 15:17:13
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 2020-06-30 15:17:13

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /data/app/rman_backup/

List of Files Unknown to the Database
=====================================
File Name: /data/app/rman_backup/ARC_0pv3fgs6_1_1.bak
File Name: /data/app/rman_backup/ARC_0qv3fgs6_1_1.bak
File Name: /data/app/rman_backup/ARC_0rv3fgs6_1_1.bak
File Name: /data/app/rman_backup/ARC_0sv3fgs6_1_1.bak
File Name: /data/app/rman_backup/FULL_0jv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0kv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0lv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0mv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0nv3fgru_1_1.bak
File Name: /data/app/rman_backup/FULL_0ov3fgs4_1_1.bak

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /data/app/rman_backup/ARC_0pv3fgs6_1_1.bak
File Name: /data/app/rman_backup/ARC_0qv3fgs6_1_1.bak
File Name: /data/app/rman_backup/ARC_0rv3fgs6_1_1.bak
File Name: /data/app/rman_backup/ARC_0sv3fgs6_1_1.bak
File Name: /data/app/rman_backup/FULL_0jv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0kv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0lv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0mv3fgrt_1_1.bak
File Name: /data/app/rman_backup/FULL_0nv3fgru_1_1.bak
File Name: /data/app/rman_backup/FULL_0ov3fgs4_1_1.bak

RMAN> run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
restore database ;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=1141 device type=DISK

allocated channel: c2
channel c2: SID=1711 device type=DISK

allocated channel: c3
channel c3: SID=7 device type=DISK

allocated channel: c4
channel c4: SID=575 device type=DISK

Starting restore at 2020-06-30 15:17:30

channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to /data/app/oracle/oradata/orcl/system01.dbf
channel c1: reading from backup piece /data/app/rman_backup/FULL_0jv3fgrt_1_1.bak
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00002 to /data/app/oracle/oradata/orcl/sysaux01.dbf
channel c2: reading from backup piece /data/app/rman_backup/FULL_0kv3fgrt_1_1.bak
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00003 to /data/app/oracle/oradata/orcl/undotbs01.dbf
channel c3: reading from backup piece /data/app/rman_backup/FULL_0lv3fgrt_1_1.bak
channel c4: starting datafile backup set restore
channel c4: specifying datafile(s) to restore from backup set
channel c4: restoring datafile 00004 to /data/app/oracle/oradata/orcl/users01.dbf
channel c4: reading from backup piece /data/app/rman_backup/FULL_0nv3fgru_1_1.bak
channel c4: piece handle=/data/app/rman_backup/FULL_0nv3fgru_1_1.bak tag=TAG20200623T120516
channel c4: restored backup piece 1
channel c4: restore complete, elapsed time: 00:00:01
channel c3: piece handle=/data/app/rman_backup/FULL_0lv3fgrt_1_1.bak tag=TAG20200623T120516
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:00:03
channel c1: piece handle=/data/app/rman_backup/FULL_0jv3fgrt_1_1.bak tag=TAG20200623T120516
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:25
channel c2: piece handle=/data/app/rman_backup/FULL_0kv3fgrt_1_1.bak tag=TAG20200623T120516
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:00:25
Finished restore at 2020-06-30 15:17:55

released channel: c1

released channel: c2

released channel: c3

released channel: c4

RMAN> 

 

1.10,再次检查关闭防火墙和selinux

[oracle@dgd trace]$ setenforce 0
[root@dgd ]$ systemctl stop firewalld

1.11,启动备库

备2:

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 7349010432 bytes
Fixed Size            2267464 bytes
Variable Size         1744832184 bytes
Database Buffers     5586812928 bytes
Redo Buffers           15097856 bytes
SQL> alter database mount standby database;

Database altered.

SQL> show parameter spfile;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
spfile                     string     /data/app/oracle/product/11.2.
                         0.4/db_1/dbs/spfileorcl.ora
SQL> alter database add standby logfile;

Database altered.

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SQL> select status from v$instance;

STATUS
------------
MOUNTED
--取消日志应用
SQL> alter database recover managed standby database cancel;

Database altered.
--以open模式打开数据库
SQL> alter database open;

Database altered.

SQL> select status from v$instance;

STATUS
------------
OPEN
--开启日志应用
SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.
--查询数据库模式是否正常
SQL> set lin 3000 pages 300;
SQL> select dbid,name,open_mode,current_scn,protection_mode,database_role,force_logging,open_mode,switchover_status from v$database;

      DBID NAME      OPEN_MODE          CURRENT_SCN PROTECTION_MODE       DATABASE_ROLE    FOR OPEN_MODE         SWITCHOVER_STATUS
---------- --------- -------------------- ----------- -------------------- ---------------- --- -------------------- --------------------
1570902142 ORCL      READ ONLY WITH APPLY     2200209 MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES READ ONLY WITH APPLY NOT ALLOWED

 

2,验证

2.1,查看备2RFS和MRP应用日志进程

SQL> set lin 3000 pages 3000;
SQL> select process,sequence#,status,delay_mins from v$managed_standby;

PROCESS    SEQUENCE# STATUS      DELAY_MINS

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

ARCH         106 CLOSING           0
ARCH         105 CLOSING           0
ARCH           0 CONNECTED           0
ARCH         107 CLOSING           0
MRP0         108 APPLYING_LOG       0
RFS           0 IDLE           0
RFS         108 IDLE           0
RFS           0 IDLE           0

8 rows selected.

 

2.2,切日志查看archive log list序列是否一致

主:

SQL> alter system switch logfile;

System altered.

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     108
Next log sequence to archive   110
Current log sequence           110

 

备1:

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     108
Next log sequence to archive   0
Current log sequence           110

 

备2:

SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     109
Next log sequence to archive   0
Current log sequence           110

 

2.3,数据测试

主:

SQL> alter system switch logfile;

System altered.
SQL> create table test as select * from dba_objects;

Table created.

SQL> insert into test select * from test;

86276 rows created.

SQL> insert into test select * from test;

172552 rows created.

SQL> insert into test select * from test;

345104 rows created.

SQL> commit;

Commit complete.

SQL> insert into test select * from test;

690208 rows created.

SQL> commit;

Commit complete.

SQL> insert into test select * from test;

1380416 rows created.

SQL> commit;

Commit complete.

SQL> select count(*) from test;

  COUNT(*)
----------
   2760832

 

备1:

SQL> select count(*) from test;

  COUNT(*)
----------
   2760832

SQL> 

 

备2:

SQL> select count(*) from test;

  COUNT(*)
----------
   2760832

 

删除此数据:

主:

SQL> drop table test;

Table dropped.

SQL> select count(*) from test;
select count(*) from test
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

 

备1:

SQL> select count(*) from test;
select count(*) from test
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

 

备2:

SQL> select count(*) from test;
select count(*) from test
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

 

posted @ 2020-07-03 10:53  小渣渣呦!!!  阅读(1198)  评论(0编辑  收藏  举报