1.解锁
select t2.username,t2.sid,t2.serial#,t2.logon_time
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid order by t2.logon_time;
--查看锁
--alter system kill session 'sid,serial#';
--把锁给KILL掉
alter system kill session '146,21177';
以上转自http://www.cnblogs.com/acelove/archive/2005/12/26/304792.html
2.导出
exp 用户名/密码@实例名 file=数据文件名.dmp log=日志名.log
3,察看连接
tnsping 实例名
实例名配置文件目录oracle/ora92/network/admin/tnsnames.ora
4.查询主键外键
select * from user_constraints;
select * from user_cons_columns;
5.修改主键
--第一步:增加列key_no
alter table TB_ZHAOZHENLONG add key_no int;
--第二部:给key_no更新值
update TB_ZHAOZHENLONG set key_no =rownum;
commit;
--第三步:将key_no置为非空
alter table TB_ZHAOZHENLONG modify key_no int not null;
--第四步:查找主键
select constraint_name from user_constraints where constraint_type='P' and owner=user and table_name='TB_ZHAOZHENLONG' ;
--第五步:删除主键
ALTER TABLE TB_ZHAOZHENLONG DROP CONSTRAINT PK_TB_ZHAOZHENLONG;
--第六步:增加主键
ALTER TABLE TB_ZHAOZHENLONG ADD (CONSTRAINT PK_TB_ZHAOZHENLONG PRIMARY KEY(c_1,c_2,c_3);
实例:
alter table lploan add ContNo VARCHAR2(20) NOT NULL;
ALTER TABLE lploan DROP CONSTRAINT PK_LPLOAN;
alter table LPLOAN add constraint PK_LPLOAN primary key (POLNO, EDORTYPE, EDORNO,CONTNO);
--添加LORETURNLOAN表