|
课程第10次(2018-10-25星期四)
SYS:
- grant create public database link to hr;
- alter user sh identified by oracle_4U account unlock;
- drop public database link dblink1;
复制代码- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.3.0 Production on Thu Oct 25 19:26:02 2018
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- SQL> conn hr/oracle_4U
- Connected.
- SQL> select salary from employees where employee_id=100;
- SALARY
- ----------
- 24007
- SQL> create database link dblink1 connect to hr identified by hr using 'utforcl';
- Database link created.
- SQL> create public database link dblink1 connect to hr identified by hr using 'utforcl';
- create public database link dblink1 connect to hr identified by hr using 'utforcl'
- *
- ERROR at line 1:
- ORA-01031: insufficient privileges
- SQL> create public database link dblink1 connect to hr identified by hr using 'utforcl';
- Database link created.
- SQL> select salary from employees where employee_id=100;
- SALARY
- ----------
- 24007
- SQL> select salary from employees@dblink1 where employee_id=100;
- SALARY
- ----------
- 33333
- SQL> conn sh/oracle_4U
- Connected.
- SQL> select salary from hr.employees@dblink1 where employee_id=100;
- SALARY
- ----------
- 33333
- SQL> /
- select salary from hr.employees@dblink1 where employee_id=100
- *
- ERROR at line 1:
- ORA-02019: connection description for remote database not found
- SQL> conn hr/oracle_4U
- Connected.
- SQL> select salary from hr.employees@dblink1 where employee_id=100;
- SALARY
- ----------
- 33333
- SQL>
复制代码
PARFILE:
- directory=dir1
- dumpfile=my2.dmp
- schemas=hr
- job_name=my2_job
- exclude=table:"in ('T_BANK_INVOICE')", procedure:"in ('SECURE_DML')"
- query='employees:where department_id=90'
- flashback_time='2018-10-25:20:14:22'
- version=11.2.0.1
复制代码
目的地:
网络链的模式:
- directory=dirwin
- schemas=hr
- job_name=my3_job
- exclude=table:"in ('T_BANK_INVOICE')", procedure:"in ('SECURE_DML')"
- query='hr.employees:where department_id=90'
- flashback_time='2018-10-25:20:14:22'
- network_link=dblinkwin
- remap_schema=hr:usern
复制代码- impdp system/oracle_4U parfile=parfile1.txt
复制代码
FULL / attach:
- expdp system/oracle_4U directory=dir1 dumpfile=full_%U.dmp filesize=2G full=y job_name=myfull
复制代码
datapump外部表的导出,就是把任何一个视图变成操作系统上可移动的一个文件:
- CREATE TABLE hr.ext_emp_query_results
- ORGANIZATION EXTERNAL
- (
- TYPE ORACLE_DATAPUMP
- DEFAULT DIRECTORY dir1
- LOCATION ('emp1.exp','emp2.exp','emp3.exp')
- )
- PARALLEL 8
- AS
- SELECT e.first_name,e.last_name,d.department_name
- FROM hr.employees e, hr.departments d
- WHERE e.department_id = d.department_id AND
- d.department_name in
- ('Marketing', 'Purchasing');
复制代码
导入的时候列名要一样,精度>=原来的精度:
- [oracle@station90 dir1]$ strings emp1.exp
复制代码- "SYS"."U"
- x86_64/Linux 2.4.xx
- AL32UTF8
- 11.02.00.00.00
- 001:001:000001:000001
- i<?xml version="1.0"?>
- <ROWSET>
- <ROW>
- <STRMTABLE_T>
- <VERS_MAJOR>1</VERS_MAJOR>
- <VERS_MINOR>0 </VERS_MINOR>
- <VERS_DPAPI>3</VERS_DPAPI>
- <ENDIANNESS>0</ENDIANNESS>
- <CHARSET>AL32UTF8</CHARSET>
- <NCHARSET>AL16UTF16</NCHARSET>
- <DBTIMEZONE>+00:00</DBTIMEZONE>
- <OWNER_NAME>HR</OWNER_NAME>
- <NAME>EXT_EMP_QUERY_RESULTS</NAME>
- <COL_LIST>
- <COL_LIST_ITEM>
- <COL_NUM>1</COL_NUM>
- <NAME>FIRST_NAME</NAME>
- <TYPE_NUM>1</TYPE_NUM>
- <LENGTH>20</LENGTH>
- <PRECISION_NUM>0</PRECISION_NUM>
- <SCALE>0</SCALE>
- <CHARSETID>873</CHARSETID>
- <CHARSETFORM>1</CHARSETFORM>
- <CHARLENGTH>20</CHARLENGTH>
- </COL_LIST_ITEM>
- <COL_LIST_ITEM>
- <COL_NUM>2</COL_NUM>
- <NAME>LAST_NAME</NAME>
- <TYPE_NUM>1</TYPE_NUM>
- <LENGTH>25</LENGTH>
- <PRECISION_NUM>0</PRECISION_NUM>
- <SCALE>0</SCALE>
- <CHARSETID>873</CHARSETID>
- <CHARSETFORM>1</CHARSETFORM>
- <CHARLENGTH>25</CHARLENGTH>
- </COL_LIST_ITEM>
- <COL_LIST_ITEM>
- <COL_NUM>3</COL_NUM>
- <NAME>DEPARTMENT_NAME</NAME>
- <TYPE_NUM>1</TYPE_NUM>
- <LENGTH>30</LENGTH>
- <PRECISION_NUM>0</PRECISION_NUM>
- <SCALE>0</SCALE>
- <CHARSETID>873</CHARSETID>
- <CHARSETFORM>1</CHARSETFORM>
- <CHARLENGTH>30</CHARLENGTH>
- </COL_LIST_ITEM>
- </COL_LIST>
- </STRMTABLE_T>
- </ROW>
- </ROWSET>
- Michael Hartstein Marketing<
- Fay Marketing<
- Raphaely
- Purchasing<
- Alexander
- Khoo
- Purchasing<
- Shelli
- Baida
- Purchasing<
- Sigal
- Tobias
- Purchasing<
- Himuro
- Purchasing<
- Karen
- Colmenares
- Purchasing
- [oracle@station90 dir1]$
复制代码
上完1Z0-052 第17章 导入导出 (7/40)
|
|