1. 程式人生 > 其它 >orale之命令列建立&刪除資料庫

orale之命令列建立&刪除資料庫

建立資料庫檔案

CREATE TABLESPACE MyDataBase LOGGING DATAFILE 'D:\Oracle\database\MyDataBase.dbf' SIZE 00M AUTOEXTEND ON NEXT 3M MAXSIZE 500M EXTENT MANAGEMENT LOCAL;

MyDataBase:資料庫名稱		D:\Oracle\database\MyDataBase.dbf:資料庫檔案目錄

建立資料庫臨時檔案

create temporary TABLESPACE MyDataBase_temp tempfile 'D:\Oracle\database\MyDataBase_temp.dbf' SIZE 00M AUTOEXTEND ON NEXT 3M MAXSIZE 500M EXTENT MANAGEMENT LOCAL;

MyDataBase_temp:資料庫臨時檔名稱			D:\Oracle\database\MyDataBase_temp.dbf:資料庫臨時檔案目錄

建立使用者與上述兩個檔案形成對映關係

CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE MyDataBase TEMPORARY TABLESPACE MyDataBase_temp;

username:使用者名稱
password:密碼
MyDataBase:對映的資料庫名稱
MyDataBase_temp:對映的資料庫臨時檔名稱

新增使用者許可權

grant connect,resource,dba to username;
grant create session to username;

刪除資料庫

conn sys/dwh as sysdba;
drop tablespace MyDataBase including contents and datafiles;
drop tablespace MyDataBase_temp including contents and datafiles;

刪除使用者
drop user username cascade;