標籤:oracle 命令
今日數據庫用戶被鎖,查了下,說是登錄錯誤超過10次用戶就會被鎖定,於是有瞭解鎖和改密碼操作
以不鏈接數據庫方式啓動sqlplus
sqlplus /nolog;
以dba身份鏈接數據庫:
conn /as sysdba;
數據庫啓動模式及用處:
startup:open模式,啓動實例加載並打開數據庫,正常啓動
非受限狀態
受限狀態:startup restrict,只有DBA可以訪問數據庫
執行數據導入導出;
使用sql*loader提取外部數據;
需要暫時拒絕普通用戶訪問數據庫;
進行數據庫移植或升級操作;
startup force:強行啟動資料庫(貌似存在一定風險)
startup mount:mount模式,啓動實例和加載數據庫,但不打開數據庫(尚未弄明白其中含義)
重新命名數據庫;
添加、刪除、重新命名日誌檔案;
執行數據庫完全恢復模式;
改變數據的歸檔模式;
startup nomount:nomount模式,啓動實例不加載數據庫。僅爲實例創建各種內存結構和服務進程,用於
創建數據庫;
重建控制檔案;
狀態間轉換:
轉open模式:Alter database open
轉mount模式:Alter database mount
轉nomount模式:Alter database nomount
保留狀態改變為非保留狀態:alter system disable restricted session
非保留狀態變為保留狀態:alter system enable restricted session
資料庫唯讀狀態:alter database open read only
資料庫讀寫狀態:alter database open read write
關閉數據庫:
1.shutdown:正常關閉,等待鏈接結束
2.shutdown immediate:立即關閉
3.shutdown transactional:關閉事物
4.shutdown abort:強行關閉(存在風險)
解鎖:
alter user username account unlock;其中username為被鎖定的使用者名稱。
改密碼:
alter user username identified by password;其中username為使用者名稱,password為新密碼。
測試數據庫鏈接:
tnsping TEST 來獲得資料庫TEST能否連上
本文出自 “morrowind” 部落格,請務必保留此出處http://morrowind.blog.51cto.com/1181631/1713410
Oracle 常用命令