oracle學習(1)

1.系統用戶有sys,system,sysman,scott

sys權限高於system,在使用sys登陸數據庫的時候要使用管理員或系統操作人員的權限登陸

sysman也是管理員級別的用戶

scott是提供給學習者學習的用戶(默認密碼tiger)

2.show user 命令查看當前用戶

dba_users 數據字典  數據字典是數據庫提供的表,用來查看數據庫信息

desc dba_users查看錶信息

3.scott 用戶默認是鎖定的,登陸前要先解鎖

鎖定scott用戶 alter user scott  account lock

解鎖scott用戶 alter user scott account unlock

在其他用戶裏解鎖scott然後用connect scott/tiger登陸

4.表空間分爲 永久表空間 、臨時表空間 、UNDO表空間

永久表空間主要存放數據庫表、視圖、存儲過程等,臨時表空間主要存放數據庫操作的中間執行過程,執行完之後自動釋放

查看用戶表空間   dba_tablespaces、user_tablespaces 數據字典

                              dba_users、user_users 數據字典

(desc dba_tablespaces)

5.創建表空間create [temporary]tablespace tablespace_name datafile | tempfile 'xx.dbf' size xx;

查看錶空間的具體路徑 

desc dba_data_files | dba_temp_files

select flie_name from dba_data_files | dba_temp_files where tablespace_name='表空間名字大寫';

6.修改表空間

修改表空間的狀態

  • 聯機或脫機 alter tablespace tablespace_name online | offline
  • 只讀或可讀寫  alter tablespace tablespace_name read only | read write
  • 查看錶空間狀態 select status from dba_tablespaces where tablespace_name='表空間名字大寫'

修改表空間的數據文件

  • 增加 alter tablespace tablespace_name add  datafile 'xxx.bdf' size xx;
  • 刪除 alter tablespace tablespace_name drop datafile 'xxx.bdf';(不能刪除表空間第一個數據文件)

刪除表空間及數據文件 drop tablespace tablespace_name [including contents]

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章