oracle常用命令

注:

oracle数据库修改后,是没有返回的

 

1.linux下修改oracle数据库用户密码

切换到oracle 用户(linux上的用户): su - oracle
使用sqlplus并以管理员的身份登录: sqlplus / as sysdba
alter user 数据库连接用户名 identified by 新密码; #直接生效

eg:

alter user mryx  identified by walibo;
sqlplus mryx/walibo      #登录

 

2.解锁

alter user mryx  identified by  walibo  account  unlock;    #解锁

 

3.查某个用户的生命周期限定  默认180天

SELECT LIMIT FROM dba_profiles s where s.profile =( SELECT PROFILE FROM dba_users where USERNAME='用户名') and RESOURCE_NAME='PASSWORD_LIFE_TIME' ;
SELECT LIMIT FROM dba_profiles s where s.profile =( SELECT PROFILE FROM dba_users where USERNAME='mryx') and RESOURCE_NAME='PASSWORD_LIFE_TIME' ;
SELECT LIMIT FROM dba_profiles s where s.profile =( SELECT PROFILE FROM dba_users where USERNAME='SYSTEM') and RESOURCE_NAME='PASSWORD_LIFE_TIME' ;

 4.可查看是否有服务连着数据库

select machine,client_info,program from gv$session where username is not null group by inst_id,machine,client_info,program order by machine DESC;

 

5.删除表

drop table table_name; 

 

6. 在oracle 里面 增删改  ,即插入数据,删除数据,修改数据之后,都需要提交事务,即执行 commit; 只有执行commit; 才会生效。否则别人查不到。这是oracle特有的。  

    修改表 创建表 删除表是不需要commit的。

 

posted @ 2019-05-22 14:48  邓旭阳  阅读(186)  评论(0)    收藏  举报