oracle常用命令

來源:互聯網
上載者:User

標籤:io   ar   for   檔案   資料   art   sp   log   on   

1、分區關鍵字段不能更新
    alter table t_xj_hd enable row movement;
2、資料庫解鎖
   alter user srdh account unlock(SYS登陸)

3、增加分區
   alter table TDM_IN_CCR_TRMNL_PREFER_M add partition P201211 values (201211) tablespace TBS_DM

4、查詢sql效能
   select * from v$sql
   
5、增加欄位
   alter  table tab2 add col2 number(20)
   
5、修改欄位屬性
   alter  table tab2 modify col1 varchar2(20)
   
6、查詢使用者資料表空間
Select default_tablespace 預設資料表空間,temporary_tablespace  暫存資料表空間 from dba_users Where username = ‘SRDH_06‘

7、啟動資料庫
   lsnrctl start
啟動資料庫
    sqlplus /nolog
    connect / as sysdba
--connect sys/longtop as sysdba
startup

8、關閉資料庫
   lsnrctl stop
    sqlplus /nolog
    connect / as sysdba
    shutdown immediate
    
9、資料庫解鎖
  alter user username account unlock;
 
10、匯出dmp檔案命令
  Exp bicp/[email protected] file=/home/oracle/masa_func.dmp tables=masa_func  (指定表)
  Exp bicp/[email protected] file=/home/oracle/masa_func.dmp (匯出使用者下所有對象)

11、匯入檔案
  imp bicp/[email protected] file=ghg.dmp log=ghg.log full=y ignore=y
 
12、查詢一段時間之前的表資料
    select * from tab1 as of timestamp sysdate - interval ‘200‘ minute;
 
13、加主鍵
 alter table TAVBNAME add constraint 約束名 primary key (ID);
 
14、建同義字
 create or replace synonym 同義字名 for 使用者名稱.表名;

15、加外鍵
alter table 表名
  add foreign key (欄位)
  references 指向表 (指向表欄位);

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.