Oracle建資料表空間及使用者

來源:互聯網
上載者:User

建立資料庫連結

--建立連結(建在目標庫)CREATE [PUBLIC] DATABASE LINK linkNameCONNECT TO username IDENTIFIED BY passwordUSING ‘connectstring’;--CREATE PUBLIC DATABASE LINK 資料庫連結名 CONNECT TO 使用者名稱 identified by 密碼 using '源庫的描述(一般為源庫名)'--其中,'源庫的描述(一般為源庫名)'必須為如下格式:--connectstring=(DESCRIPTION =--  (ADDRESS_LIST = --    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.142.10.201)(PORT = 1521))--  )--  (CONNECT_DATA =--    (SERVICE_NAME=ORCL)--  )--)

查看錶空間檔案

select file#, name from v$datafile;

建立資料表空間

CREATE TABLESPACE JJTGDATA DATAFILE 'D:\oracle_data\jjtg\JJTGDATA01.DBF' SIZE 200M AUTOEXTEND ON NEXT 200M maxsize unlimited loggingextent management local autoallocatesegment space management auto;

修改資料表空間

alter database datafile 'D:\oracle_data\jjtg\JJTGDATA01.DBF' resize 500m; //手動修改資料檔案大小為500M

更改資料表空間資料檔案名

shutdown   immediate; startup   mount; alter   database   rename   'old_path_filename '   to   'new_path_filename ';

刪除資料表空間
    1.如果資料表空間裡面沒有任何資料對象,可以直接刪除.  

DROP TABLESPACE JJTGDATA;

    這種刪除方式相關的資料檔案仍然存在於磁碟上.

    2.空間裡面含有資料對象,要刪除該資料表空間,可加上including contents子句.

DROP TABLESPACE JJTGDATA including contents;

    這種刪除方式相關的資料檔案仍然存在於磁碟上.

    3.刪除資料表空間,同時刪除資料檔案

DROP TABLESPACE JJTGDATA INCLUDING CONTENTS AND DATAFILES;

    資料表空間和資料檔案全部刪除。

建立使用者

create user user_name identified by user_pwddefault tablespace JJTGDATAquota unlimited on JJTGDATAaccount unlock;

授予許可權

grant connect,resource  user_name;grant dba to user_name;

撤消使用者權限

revoke connect,resource from user_name;revoke dba from user_name;

ORA-01950: 對錶空間‘JJTGDATA’無許可權
以sys使用者登入
alter user jjtg default_tablespace JJTGDATA; --修改預設資料表空間alter user jjtg quota unlimited to JJTGDATA; --修改配額

匯入表結構和資料:

--匯入表結構和資料,用cmd命令方式--imp 使用者名稱/密碼@資料庫 full=y file=D:\xxxx\匯出表結構資料檔案名.dmpimp user/pwd@db full=y file=D:\2012-07-16\jjtguserdata.dmp

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.