【RMAN】表空間基於時間點的RMAN恢復-TSPITR

海星星hktk發表於2016-04-29
表空間基於時間點的RMAN恢復-TSPITR
RMAN Tablespace Point-in-Time Recovery (TSPITR)



官方文件:Database Backup and Recovery User's Guide
21 Performing RMAN Tablespace Point-in-Time Recovery (TSPITR)
Performing Fully Automated RMAN TSPITR


一、環境準備

【檢視當前資料庫,處於歸檔模式】

SYS@PROD>archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/arch
Oldest online log sequence     6
Next log sequence to archive   8
Current log sequence           8
SYS@PROD>



【建立測試表空間testtbs】
SYS@PROD>create tablespace testtbs
  2  datafile '/u01/app/oracle/oradata/PROD/testtbs01.dbf'
  3  size 100m autoextend on;

Tablespace created.



【建立測試使用者damon,設定damon使用者預設表空間testtbs】
SYS@PROD>grant connect,resource to damon identified by oracle;
Grant succeeded.

SYS@PROD>alter user damon default tablespace testtbs;
User altered.
SYS@PROD>


SYS@PROD>select username,default_tablespace from dba_users where username='DAMON';
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
DAMON                          TESTTBS
SYS@PROD>


SYS@PROD>grant select on scott.emp to damon;
Grant succeeded.
SYS@PROD>grant select on scott.dept to damon;
Grant succeeded.



實驗之前,rman做一次全備

RMAN> run{
2> shutdown immediate;
3> startup mount;
4> backup as compressed backupset database format '/u01/app/oracle/backup/full_%U.bak';
5> alter database open;
6> }

database closed
database dismounted
Oracle instance shut down

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     836976640 bytes

Fixed Size                     1348160 bytes
Variable Size                490737088 bytes
Database Buffers             339738624 bytes
Redo Buffers                   5152768 bytes

Starting backup at 17-JUL-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/PROD/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/PROD/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/PROD/example01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/PROD/testtbs01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/PROD/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/PROD/users01.dbf
channel ORA_DISK_1: starting piece 1 at 17-JUL-15
channel ORA_DISK_1: finished piece 1 at 17-JUL-15
piece handle=/u01/app/oracle/backup/full_03qca1of_1_1.bak tag=TAG20150717T202031 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:25
Finished backup at 17-JUL-15

Starting Control File and SPFILE Autobackup at 17-JUL-15
piece handle=/u01/app/oracle/backup/c-280335848-20150717-01 comment=NONE
Finished Control File and SPFILE Autobackup at 17-JUL-15

database opened

RMAN>



切換到測試使用者damon
SYS@PROD>conn damon/oracle
Connected.


【建立測試表emp01】
DAMON@PROD>create table emp01 as select * from scott.emp;
Table created.

DAMON@PROD>select * from emp01;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

14 rows selected.

DAMON@PROD>


DAMON@PROD>select table_name,tablespace_name from user_tables;

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
EMP01                          TESTTBS


【檢視誤操作前scn、時間

SYS@PROD>select current_scn from v$database;

CURRENT_SCN
-----------
     898547

SYS@PROD>select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2015-07-17 20:36:35

SYS@PROD>


【模擬誤操作,porge刪除emp01表】
DAMON@PROD>drop table emp01 purge;
Table dropped.

DAMON@PROD>select table_name,tablespace_name from user_tables;
no rows selected


模擬誤操作後其他業務操作,建立新表dept01
DAMON@PROD>create table dept01 as select * from scott.dept;

Table created.

DAMON@PROD>select * from dept01;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

DAMON@PROD>

DAMON@PROD>select table_name,tablespace_name from user_tables;

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
DEPT01                         TESTTBS

DAMON@PROD>




二、RMAN TSPITR

檢查自包含

SYS@PROD>EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('TESTTBS', TRUE,TRUE);
PL/SQL procedure successfully completed.

SYS@PROD>SELECT * FROM  TRANSPORT_SET_VIOLATIONS;
no rows selected

SYS@PROD>


Identify and Preserve Objects That Are Lost After TSPITR




使用時間點,檢視進行TSPITR恢復之後,與當前狀態相比會丟失的資料表
SYS@PROD>SELECT OWNER, NAME, TABLESPACE_NAME,
  2         TO_CHAR(CREATION_TIME, 'yyyy-mm-dd hh24:mi:ss')
  3         FROM TS_PITR_OBJECTS_TO_BE_DROPPED
  4  WHERE TABLESPACE_NAME ='TESTTBS'
  5  AND CREATION_TIME > TO_DATE('2015-07-17 20:36:35','yyyy-mm-dd hh24:mi:ss')
  6  ORDER BY TABLESPACE_NAME, CREATION_TIME;

OWNER      NAME       TABLESPACE_NAME      TO_CHAR(CREATION_TI
---------- ---------- -------------------- -------------------
DAMON      DEPT01     TESTTBS              2015-07-17 20:38:22



使用SCN檢視
SYS@PROD>SELECT OWNER, NAME, TABLESPACE_NAME,
  2         TO_CHAR(CREATION_TIME,'YYYY-MM-DD:HH24:MI:SS')
  3         FROM TS_PITR_OBJECTS_TO_BE_DROPPED
  4  WHERE TABLESPACE_NAME ='TESTTBS'
  5  AND CREATION_TIME > TO_DATE(TO_CHAR(SCN_TO_TIMESTAMP(898547),
  6  'MM/DD/YYYY HH24:MI:SS'),
  7  'MM/DD/YYYY HH24:MI:SS')
  8  ORDER BY TABLESPACE_NAME, CREATION_TIME;

OWNER      NAME       TABLESPACE_NAME      TO_CHAR(CREATION_TI
---------- ---------- -------------------- -------------------
DAMON      DEPT01     TESTTBS              2015-07-17:20:38:22

SYS@PROD>







將此表提前匯出
[oracle@oracle ~]$ exp damon/oracle file=dept01.dmp tables=DEPT01

Export: Release 11.2.0.3.0 - Production on Fri Jul 17 20:50:18 2015

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


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table                         DEPT01          4 rows exported
Export terminated successfully without warnings.
[oracle@oracle ~]$


SYS@PROD>select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME      STATUS
-------------------- ---------
SYSTEM               ONLINE
SYSAUX               ONLINE
UNDOTBS1             ONLINE
TEMP                 ONLINE
USERS                ONLINE
EXAMPLE              ONLINE
TESTTBS              ONLINE

7 rows selected.

SYS@PROD>



[oracle@oracle ~]$ mkdir /u01/app/oracle/auxdest

【RMAN執行TSPITR】


RMAN> recover tablespace testtbs until scn 898547
2> auxiliary destination '/u01/app/oracle/auxdest';

Starting recover at 17-JUL-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1

Creating automatic instance, with SID='zaBw'

initialization parameters used for automatic instance:
db_name=PROD
db_unique_name=zaBw_tspitr_PROD
compatible=11.2.0.0.0
db_block_size=8192
db_files=200
sga_target=280M
processes=50
db_create_file_dest=/u01/app/oracle/auxdest
log_archive_dest_1='location=/u01/app/oracle/auxdest'
#No auxiliary parameter file used


starting up automatic instance PROD

Oracle instance started

Total System Global Area     292933632 bytes

Fixed Size                     1344512 bytes
Variable Size                100666368 bytes
Database Buffers             184549376 bytes
Redo Buffers                   6373376 bytes
Automatic instance created
Running TRANSPORT_SET_CHECK on recovery set tablespaces
TRANSPORT_SET_CHECK completed successfully

contents of Memory Script:
{
# set requested point in time
set until  scn 898547;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log
sql 'alter system archive log current';
# avoid unnecessary autobackups for structural changes during TSPITR
sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
}
executing Memory Script

executing command: SET until clause

Starting restore at 17-JUL-15
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/c-280335848-20150717-01
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/c-280335848-20150717-01 tag=TAG20150717T202356
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/auxdest/PROD/controlfile/o1_mf_btkz53q2_.ctl
Finished restore at 17-JUL-15

sql statement: alter database mount clone database

sql statement: alter system archive log current

sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;

contents of Memory Script:
{
# set requested point in time
set until  scn 898547;
plsql <<<-- tspitr_2
declare
  sqlstatement       varchar2(512);
  offline_not_needed exception;
  pragma exception_init(offline_not_needed, -01539);
begin
  sqlstatement := 'alter tablespace '||  'TESTTBS' ||' offline immediate';
  krmicd.writeMsg(6162, sqlstatement);
  krmicd.execSql(sqlstatement);
exception
  when offline_not_needed then
    null;
end; >>>;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  2 to new;
set newname for clone tempfile  1 to new;
set newname for datafile  6 to
 "/u01/app/oracle/oradata/PROD/testtbs01.dbf";
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 3, 2, 6;
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

sql statement: alter tablespace TESTTBS offline immediate

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/auxdest/PROD/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 17-JUL-15
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/auxdest/PROD/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/auxdest/PROD/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/auxdest/PROD/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/testtbs01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/full_03qca1of_1_1.bak
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/full_03qca1of_1_1.bak tag=TAG20150717T202031
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:06
Finished restore at 17-JUL-15

datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=885330278 file name=/u01/app/oracle/auxdest/PROD/datafile/o1_mf_system_btkz5dw7_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=885330278 file name=/u01/app/oracle/auxdest/PROD/datafile/o1_mf_undotbs1_btkz5dz5_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=885330278 file name=/u01/app/oracle/auxdest/PROD/datafile/o1_mf_sysaux_btkz5dwf_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 898547;
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  3 online";
sql clone "alter database datafile  2 online";
sql clone "alter database datafile  6 online";
# recover and open resetlogs
recover clone database tablespace  "TESTTBS", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  2 online

sql statement: alter database datafile  6 online

Starting recover at 17-JUL-15
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 8 is already on disk as file /u01/app/oracle/arch/1_8_868497516.dbf
archived log file name=/u01/app/oracle/arch/1_8_868497516.dbf thread=1 sequence=8
media recovery complete, elapsed time: 00:00:00
Finished recover at 17-JUL-15

database opened

contents of Memory Script:
{
# make read only the tablespace that will be exported
sql clone 'alter tablespace  TESTTBS read only';
# create directory for datapump import
sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/auxdest''";
# create directory for datapump export
sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/auxdest''";
}
executing Memory Script

sql statement: alter tablespace  TESTTBS read only

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/auxdest''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/auxdest''

Performing export of metadata...
   EXPDP> Starting "SYS"."TSPITR_EXP_zaBw":  
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
   EXPDP> Master table "SYS"."TSPITR_EXP_zaBw" successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYS.TSPITR_EXP_zaBw is:
   EXPDP>   /u01/app/oracle/auxdest/tspitr_zaBw_36989.dmp
   EXPDP> ******************************************************************************
   EXPDP> Datafiles required for transportable tablespace TESTTBS:
   EXPDP>   /u01/app/oracle/oradata/PROD/testtbs01.dbf
   EXPDP> Job "SYS"."TSPITR_EXP_zaBw" successfully completed at 21:06:21
Export completed


contents of Memory Script:
{
# shutdown clone before import
shutdown clone immediate
# drop target tablespaces before importing them back
sql 'drop tablespace  TESTTBS including contents keep datafiles';
}
executing Memory Script

database closed
database dismounted
Oracle instance shut down

sql statement: drop tablespace  TESTTBS including contents keep datafiles

Performing import of metadata...
   IMPDP> Master table "SYS"."TSPITR_IMP_zaBw" successfully loaded/unloaded
   IMPDP> Starting "SYS"."TSPITR_IMP_zaBw":  
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
   IMPDP> Job "SYS"."TSPITR_IMP_zaBw" successfully completed at 21:07:06
Import completed


contents of Memory Script:
{
# make read write and offline the imported tablespaces
sql 'alter tablespace  TESTTBS read write';
sql 'alter tablespace  TESTTBS offline';
# enable autobackups after TSPITR is finished
sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;';
}
executing Memory Script

sql statement: alter tablespace  TESTTBS read write

sql statement: alter tablespace  TESTTBS offline

sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end;

Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/app/oracle/auxdest/PROD/datafile/o1_mf_temp_btkzcgn2_.tmp deleted
auxiliary instance file /u01/app/oracle/auxdest/PROD/onlinelog/o1_mf_3_btkzccxh_.log deleted
auxiliary instance file /u01/app/oracle/auxdest/PROD/onlinelog/o1_mf_2_btkzc9k6_.log deleted
auxiliary instance file /u01/app/oracle/auxdest/PROD/onlinelog/o1_mf_1_btkzc70n_.log deleted
auxiliary instance file /u01/app/oracle/auxdest/PROD/datafile/o1_mf_sysaux_btkz5dwf_.dbf deleted
auxiliary instance file /u01/app/oracle/auxdest/PROD/datafile/o1_mf_undotbs1_btkz5dz5_.dbf deleted
auxiliary instance file /u01/app/oracle/auxdest/PROD/datafile/o1_mf_system_btkz5dw7_.dbf deleted
auxiliary instance file /u01/app/oracle/auxdest/PROD/controlfile/o1_mf_btkz53q2_.ctl deleted
Finished recover at 17-JUL-15

RMAN>



檢視錶空間狀態
SYS@PROD>select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME      STATUS
-------------------- ---------
SYSTEM               ONLINE
SYSAUX               ONLINE
UNDOTBS1             ONLINE
TEMP                 ONLINE
USERS                ONLINE
EXAMPLE              ONLINE
TESTTBS              OFFLINE

7 rows selected.

SYS@PROD>


【表空間online之前,rman備份一次】

RMAN> backup tablespace testtbs format '/u01/app/oracle/backup/testtbs_%U';

Starting backup at 17-JUL-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/u01/app/oracle/oradata/PROD/testtbs01.dbf
channel ORA_DISK_1: starting piece 1 at 17-JUL-15
channel ORA_DISK_1: finished piece 1 at 17-JUL-15
piece handle=/u01/app/oracle/backup/testtbs_05qca4kv_1_1 tag=TAG20150717T210951 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-JUL-15

Starting Control File and SPFILE Autobackup at 17-JUL-15
piece handle=/u01/app/oracle/backup/c-280335848-20150717-02 comment=NONE
Finished Control File and SPFILE Autobackup at 17-JUL-15

RMAN>






【online表空間】

RMAN> sql "alter tablespace testtbs online";
sql statement: alter tablespace testtbs online

RMAN>


SYS@PROD>select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME      STATUS
-------------------- ---------
SYSTEM               ONLINE
SYSAUX               ONLINE
UNDOTBS1             ONLINE
TEMP                 ONLINE
USERS                ONLINE
EXAMPLE              ONLINE
TESTTBS              ONLINE

7 rows selected.



SYS@PROD>select * from damon.emp01;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

14 rows selected.
SYS@PROD>



DAMON@PROD>select * from cat;

TABLE_NAME                     TABLE_TYPE
------------------------------ -----------
EMP01                          TABLE

DAMON@PROD>



【imp將誤操作之後業務建立的其他表匯入(dept01)】
[oracle@oracle ~]$ imp damon/oracle file=dept01.dmp

Import: Release 11.2.0.3.0 - Production on Fri Jul 17 21:21:33 2015

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


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
. importing DAMON's objects into DAMON
. importing DAMON's objects into DAMON
. . importing table                       "DEPT01"          4 rows imported
Import terminated successfully without warnings.
[oracle@oracle ~]$


DAMON@PROD>select * from cat;

TABLE_NAME                     TABLE_TYPE
------------------------------ -----------
DEPT01                         TABLE
EMP01                          TABLE

DAMON@PROD>select * from dept01;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

DAMON@PROD>select * from emp01;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

14 rows selected.

DAMON@PROD>





呂星昊
2016.4.29

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

相關文章