设为首页 加入收藏

TOP

Oracle常用命令 (四)
2014-11-24 02:21:48 来源: 作者: 【 】 浏览:2
Tags:Oracle 常用 命令

   sql> log = ulcase6.log direct=true


七. 数据整理

1. 用export导出

   $exp scott/tiger tables(dept,emp) file=c:emp.dmp log=exp.log compress=n direct=y

   2. 用import导入

   $imp scott/tiger tables(dept,emp) file=emp.dmp log=imp.log ignore=y

   3. 移动表空间

   sql>alter tablespace sales_ts read only;

   $exp sys/.. file=xay.dmp transport_tablespace=y tablespace=sales_ts

   triggers=n constraints=n

   $copy datafile

   $imp sys/.. file=xay.dmp transport_tablespace=y datafiles=(/disk1/sles01.dbf,/disk2

   /sles02.dbf)

   sql> alter tablespace sales_ts read write;

   4. transport设置

   sql> DBMS_tts.transport_set_check(ts_list =>'sales_ts' ..,incl_constraints=>true);

   在表transport_set_violations 中查看

sql> dbms_tts.isselfcontained 为true 是, 表示自包含


八. 密码安全与资源管理

1. 控制帐户锁及密码

   sql> alter user juncky identified by oracle account unlock;

   2. 创建密码设置的profile文件

   sql> create profile grace_5 limit failed_login_attempts 3

   sql> password_lock_time unlimited password_life_time 30

   sql>password_reuse_time 30 password_verify_function verify_function

   sql> password_grace_time 5;

   3. 更改profile文件

   sql> alter profile default failed_login_attempts 3

   sql> password_life_time 60 password_grace_time 10;

   4. 删除profile文件

   sql> drop profile grace_5 [cascade];

   5. 创建资源限制的profile文件

   sql> create profile developer_prof limit sessions_per_user 2

   sql> cpu_per_session 10000 idle_time 60 connect_time 480;

   6. 允许资源限制

   sql> alter system set resource_limit=true;


九. 用户管理

1. 创建一个用户

   sql> create user juncky identified by oracle default tablespace users

   sql> temporary tablespace temp quota 10m on data password expire

   sql> [account lock|unlock] [profile profilename|default];

   2. 改变用户的表空间配额

   sql> alter user juncky quota 0 on users;

   3. 删除一个用户

   sql> drop user juncky [cascade];

   4. 监控用户

   view: dba_users , dba_ts_quotas

5. 查看数据库库对象

select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status;

6. 查看当前所有对象

select * from tab;

7. 显示当前连接用户

show user

8. 通过授权的方式来创建用户

grant connect,resource to test identified by test;

9. 用户间复制数据

copy from user1 to user2 create table2 using select * from table1;


十. 特权管理

1. 查看系统权限 => system_privilege_map ,dba_sys_privs,session_privs

   2. 赋权

   sql> grant create session,create table to managers;

   sql> grant create session to scott with admin option;

   with admin option can grant or revoke privilege from any user or role;

   3. sysdba and sysoper权限

   sysoper: startup,shutdown,alter database open|mount,alter database backup controlfile,

   alter tablespace begin/end backup,recover database

   alter database archivelog,restricted session

   sysdba: sysoper privileges with admin option,create database,recover database until

   4. password file members查看=> v$pwfile_users

   5. 文件访问权限设置

O7_dictionary_accessibility =true restriction access to view or tables in other schema

   6. revoke系统权限

sql> revoke create session from scott;

   7. 赋对象权限

   sql> grant execute on dbms_pipe to public;

   sql> grant update(first_name,salary) on employee to karen with grant option;

   8. 查看对象权限 => dba_tab_privs, dba_col_privs

   9. revoke对象权限

   sql> revoke execute on dbms_pipe from scott [cascade constraints];

   10. 查看审计记录=> sys.aud$

   11. 保护审计跟踪表

   sql> audit delete on sys.aud$ by access;

   12. s

首页 上一页 1 2 3 4 5 6 下一页 尾页 4/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇oracle常用命令之tnsping 下一篇设置Oracle 11Gr2 RAC的归档模式

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: