您的位置:首页 > 数据库 > Oracle

oracle 常用操作

2016-03-15 16:29 309 查看
/* 表空间test1 */

create tablespace test1

datafile 'D:\oracledabase\test1.dbf' size 30M

autoextend on next 30M maxsize unlimited logging

extent management local;

/* 用户名user1 密码user */

create user user1

identified by user default tablespace test1

temporary tablespace TEMP

profile DEFAULT;

/* 给用户授权 */

Grant connect to user1 ;

Grant resource to user1 ;

Grant unlimited tablespace to user1 ;

/*

删除表空间同时删除数据文件

drop tablespace test_data including contents and datafiles;

删除用户

drop user ×× cascade

查询用户对应默认表空间

select username,default_tablespace from dba_users;

查询系统所有表空间

select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size

from dba_tablespaces t, dba_data_files d

where t.tablespace_name = d.tablespace_name

group by t.tablespace_name;

修改用户默认表空间

alter user test1 default tablespace test1s;

查询系统表空间

select * from sys.dba_tablespaces;

*/

/*

查看用户的profile设置:

SELECT username,profile FROM dba_users;

查看系统profiles中PASSWORD_LIFE_TIME设置:

SELECT * FROM dba_profiles s WHERE s.profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';

修改DBA_PROFILES中PASSWORD_LIFE_TIM的设置,改为ULIMITED。

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

修改后设置立即生效,不需要重启数据库,此时密码永远不会过期。

已经被报告了密码快要过期的账户必须再改一次密码(需要DBA权限)

以system用户为例

sqlplus / as sysdba

alter user system identified by root;

再连接数据再也不会出现密码过期的事情了。

如果是其他用户的话,那么就使用其他用户名。

alter user scott identified by tiger;

*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: