内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

OracleExternaleTables

Oracle Externale Tables 


Creating External Tables
You create external tables using the CREATE TABLE statement with an ORGANIZATION EXTERNAL clause.  This statement creates only metadata in the data dictionary.
實驗:創(chuàng)建外部表并加載數(shù)據(jù);
EXAMPLE: Creating an External Table and Loading Data

In this example, the data for the external table resides in the two text files empxt1.dat and empxt2.dat.

The file empxt1.dat contains the following sample data:
數(shù)據(jù)一:
[oracle@chen test]$ cat empxt1.dat 
360,Jane,Janus,ST_CLERK,121,17-MAY-2001,3000,0,50,jjanus
361,Mark,Jasper,SA_REP,145,17-MAY-2001,8000,.1,80,mjasper
362,Brenda,Starr,AD_ASST,200,17-MAY-2001,5500,0,10,bstarr
363,Alex,Alda,AC_MGR,145,17-MAY-2001,9000,.15,80,aalda

The file empxt2.dat contains the following sample data:
數(shù)據(jù)二:
[oracle@chen test]$ cat empxt2.dat 
401,Jesse,Cromwell,HR_REP,203,17-MAY-2001,7000,0,40,jcromwel
402,Abby,Applegate,IT_PROG,103,17-MAY-2001,9000,.2,60,aapplega
403,Carol,Cousins,AD_VP,100,17-MAY-2001,27000,.3,90,ccousins
404,John,Richardson,AC_ACCOUNT,205,17-MAY-2001,5000,0,110,jrichard

創(chuàng)建外部表語句如下:
[root@chen ~]# mkdir /flatfiles/{data,log,bad} -p
[root@chen ~]# chown oracle.oinstall /flatfiles/ -R

[oracle@chen test]$ cat create_external.sql
CONNECT  /  AS SYSDBA;
-- Set up directories and grant access to hr 
CREATE OR REPLACE DIRECTORY admin_dat_dir
    AS '/flatfiles/data'; 
CREATE OR REPLACE DIRECTORY admin_log_dir 
    AS '/flatfiles/log'; 
CREATE OR REPLACE DIRECTORY admin_bad_dir 
    AS '/flatfiles/bad'; 
GRANT READ ON DIRECTORY admin_dat_dir TO hr; 
GRANT WRITE ON DIRECTORY admin_log_dir TO hr; 
GRANT WRITE ON DIRECTORY admin_bad_dir TO hr;
-- hr connects. Provide the user password (hr) when prompted.
CONNECT hr
-- create the external table
CREATE TABLE admin_ext_employees
                   (employee_id       NUMBER(4), 
                    first_name        VARCHAR2(20),
                    last_name         VARCHAR2(25), 
                    job_id            VARCHAR2(10),
                    manager_id        NUMBER(4),
                    hire_date         DATE,
                    salary            NUMBER(8,2),
                    commission_pct    NUMBER(2,2),
                    department_id     NUMBER(4),
                    email             VARCHAR2(25) 
                   ) 
     ORGANIZATION EXTERNAL 
     ( 
       TYPE ORACLE_LOADER 
       DEFAULT DIRECTORY admin_dat_dir 
       ACCESS PARAMETERS 
       ( 
         records delimited by newline 
         badfile admin_bad_dir:'empxt%a_%p.bad' 
         logfile admin_log_dir:'empxt%a_%p.log' 
         fields terminated by ',' 
         missing field values are null 
         ( employee_id, first_name, last_name, job_id, manager_id, 
           hire_date char date_format date mask "dd-mon-yyyy", 
           salary, commission_pct, department_id, email 
         ) 
       ) 
       LOCATION ('empxt1.dat', 'empxt2.dat') 
     ) 
     PARALLEL 
     REJECT LIMIT UNLIMITED; 

驗證數(shù)據(jù)
SQL> set linesize 1000
SQL> select * from  admin_ext_employees;
EMPLOYEE_ID FIRST_NAME           LAST_NAME                 JOB_ID     MANAGER_ID HIRE_DATE     SALARY COMMISSION_PCT DEPARTMENT_ID EMAIL
----------- -------------------- ------------------------- ---------- ---------- --------- ---------- -------------- ------------- -------------------------
        401 Jesse                Cromwell                  HR_REP            203 17-MAY-01       7000              0            40 jcromwel
        402 Abby                 Applegate                 IT_PROG           103 17-MAY-01       9000             .2            60 aapplega
        403 Carol                Cousins                   AD_VP             100 17-MAY-01      27000             .3            90 ccousins
        404 John                 Richardson                AC_ACCOUNT        205 17-MAY-01       5000              0           110 jrichard
        360 Jane                 Janus                     ST_CLERK          121 17-MAY-01       3000              0            50 jjanus
        361 Mark                 Jasper                    SA_REP            145 17-MAY-01       8000             .1            80 mjasper
        362 Brenda               Starr                     AD_ASST           200 17-MAY-01       5500              0            10 bstarr
        363 Alex                 Alda                      AC_MGR            145 17-MAY-01       9000            .15            80 aalda

8 rows selected.

外部表不會在數(shù)據(jù)庫里創(chuàng)建對應的表段;
SQL> select * from user_segments;
no rows selected

外部表只讀,不能進行DML操作
SQL> delete admin_ext_employees where employee_id=363;
delete admin_ext_employees where employee_id=363
       *
ERROR at line 1:
ORA-30657: operation not supported on external organized table

無法通過analyze收集外部表的統(tǒng)計信息(可以通過dbms_stats收集)
SQL> analyze table admin_ext_employees compute statistics;
analyze table admin_ext_employees compute statistics
              *
ERROR at line 1:
ORA-30657: operation not supported on external organized table

SQL>  exec dbms_stats.gather_schema_stats('HR');
PL/SQL procedure successfully completed.

為善左等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及善左網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為網(wǎng)站建設、成都網(wǎng)站制作、善左網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

更詳細的信息:

http://docs.oracle.com/cd/E11882_01/server.112/e25494/tables.htm#ADMIN11706



歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長?。?!

Oracle Externale Tables

Oracle Externale Tables


網(wǎng)站標題:OracleExternaleTables
標題鏈接:http://www.rwnh.cn/article36/ghdppg.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供面包屑導航微信小程序、App設計、Google網(wǎng)站導航、小程序開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)
湛江市| 称多县| 沙湾县| 湄潭县| 靖州| 马公市| 沁阳市| 巴里| 温泉县| 新宁县| 偏关县| 紫阳县| 龙口市| 井研县| 太原市| 广安市| 兴和县| 全州县| 深水埗区| 乌兰县| 普安县| 泰州市| 河西区| 太谷县| 广南县| 西丰县| 云南省| 平谷区| 河北省| 临沭县| 中方县| 清原| 龙海市| 日喀则市| 岗巴县| 崇信县| 缙云县| 汶上县| 海城市| 淮阳县| 光山县|