Oracle 常用命令

來源:互聯網
上載者:User

標籤:oracle 命令

今日數據庫用戶被鎖,查了下,說是登錄錯誤超過10次用戶就會被鎖定,於是有瞭解鎖和改密碼操作

以不鏈接數據庫方式啓動sqlplus

    sqlplus /nolog;

以dba身份鏈接數據庫:

    conn /as sysdba;

數據庫啓動模式及用處:

  1. startup:open模式,啓動實例加載並打開數據庫,正常啓動

    1. 非受限狀態

    2. 受限狀態:startup restrict,只有DBA可以訪問數據庫

      1. 執行數據導入導出;

      2. 使用sql*loader提取外部數據;

      3. 需要暫時拒絕普通用戶訪問數據庫;

      4. 進行數據庫移植或升級操作;


  2. startup force:強行啟動資料庫(貌似存在一定風險)


  3. startup mount:mount模式,啓動實例和加載數據庫,但不打開數據庫(尚未弄明白其中含義)

    1. 重新命名數據庫;

    2. 添加、刪除、重新命名日誌檔案;

    3. 執行數據庫完全恢復模式;

    4. 改變數據的歸檔模式;


  4. startup nomount:nomount模式,啓動實例不加載數據庫。僅爲實例創建各種內存結構和服務進程,用於

    1. 創建數據庫;

    2. 重建控制檔案;

狀態間轉換:

    轉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 常用命令

聯繫我們

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