oracle建立資料庫、表空間、使用者并授權
在安裝完Oracle資料庫軟體之後可以使用預設的資料庫orcl,也可以根據需要建立自定義的資料庫。表空間用于對資料庫中的資源進行分類,每個使用者都有預設的表空間,也可以給使用者指定預設的表空間。
1、建立資料庫
簡單的方式是使用'Database Configuration Assistant'資料庫配置工具根據向導建立
2、建立表空間
在實際使用中需要建立自定義的表空間和臨時表空間
2.1、建立表空間
create tablespace tabspace_name
logging
datafile 'E:\app\oratable_space\ tabspace_name_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
其中tabspace_name是表空間名稱,'E:\app\oratable_space\ tabspace_name_temp.dbf'是表空間的完整路徑檔案名,其它參數可以根據需要進行改變
2.2、建立臨時表空間
create temporary tablespace tabspace_name_temp
tempfile 'E:\app\table_space\ tabspace_name_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
其中tabspace_name_temp是臨時表空間名稱,'E:\app\oratable_space\tabspace_name_temp.dbf'是臨時表空間的完整路徑檔案名,其它參數可以根據需要進行改變
3、建立使用者
在實際使用中需要建立使用者、指定表空間和臨時表空間并給使用者授權
3.1、建立使用者
create user user_name identified by user_password
default tablespace tabspace_name
temporary tablespace tabspace_name_temp;
3.2、給使用者授權
grant connect,resource,dba to user_name;