Oracle常用操作

來源:互聯網
上載者:User

標籤:oracle   操作   

Oracle常用的一些操作,記錄下來:

1.建立資料表空間和使用者的步驟:使用者建立:create user 使用者名稱 identified by "密碼";授權:grant create session to 使用者名稱;            grant create table to  使用者名稱;            grant create tablespace to  使用者名稱;            grant create view to  使用者名稱;                        2.資料表空間建立資料表空間(一般建N個存資料的資料表空間和一個索引空間):create tablespace 資料表空間名datafile ‘ 路徑(要先建好路徑)\***.dbf  ‘ size *Mtempfile ‘ 路徑\***.dbf ‘ size *Mautoextend on  --自動成長--還有一些定義大小的命令,看需要 default storage( initial 100K, next 100k,);例子:建立資料表空間create tablespace DEMOSPACE datafile ‘E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf‘ size 1500M autoextend on next 5M maxsize 3000M;刪除資料表空間drop tablespace DEMOSPACE including contents and datafiles3.使用者權限授予使用者使用資料表空間的許可權:alter user 使用者名稱 quota unlimited on 資料表空間;或 alter user 使用者名稱 quota *M on 資料表空間;4.--資料表空間CREATE TABLESPACE sdtDATAFILE ‘F:\tablespace\demo‘ size 800M         EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; --索引資料表空間CREATE TABLESPACE sdt_IndexDATAFILE ‘F:\tablespace\demo‘ size 512M                  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;     --2.建使用者create user demo identified by demo default tablespace demo; --3.賦權grant connect,resource to demo;grant create any sequence to demo;grant create any table to demo;grant delete any table to demo;grant insert any table to demo;grant select any table to demo;grant unlimited tablespace to demo;grant execute any procedure to demo;grant update any table to demo;grant create any view to demo;5.--匯入匯出命令   ip匯出方式: exp demo/[email protected]:1521/orcl file=f:/f.dmp full=yexp demo/[email protected] file=f:/f.dmp full=yimp demo/[email protected] file=f:/f.dmp full=y ignore=y6.--建立資料鏈create database link ygbgtest_portaltest_link    connect to portal identified by portal    using ‘(DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.104.102)(PORT = 1521))     )     (CONNECT_DATA =       (SERVICE_NAME = orcl)     )   )‘;   select * from [email protected]_portaltest_link;   7.--建立暫存資料表以擷取遠端資料表資料   Create global temporary table temp_ygbg_information on commit preserve rows as select * from [email protected]_portaltest_link;select count(1) from temp_ygbg_information t;select * from temp_ygbg_information;8.--從暫存資料表中將資料插入到目的表中insert into portal_information  (id,   title,   picture_url,   status,   author_id,   author_name,   create_time,   modify_date,   delete_date,   view_num,   order_flag,   summary,   type,   promulgation_charge,   information_source,   sort_num,   sub_title,   is_slidenews) select    SEQ_PORTAL_INFORMATION.NEXTVAL,   title,   picture_url,   status,   author_id,   author_name,   create_time,   modify_date,   delete_date,   view_num,   order_flag,   summary,   type,   promulgation_charge,   information_source,   sort_num,   sub_title,   is_slidenews from temp_ygbg_information t1 where t1.id=3338;


本文出自 “憤怒的蝸牛” 部落格,請務必保留此出處http://yangxianhong.blog.51cto.com/5707396/1561984

Oracle常用操作

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.