標籤: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常用命令