好学IT学院:IT信息技术分享交流平台
来源:本站整理  作者:学生大读书站  发布时间:2006-12-23  ★★★加入收藏〗〖手机版
摘要://创建一个控制文件命令到跟踪文件 alter database backup controlfile to trace;//增加一个新的日志文件组的语句 connect internal as sysdba alter database ……

//创建操作系统用户
REM  Creating OPS$ accounts
create user OPS$FARMER
identified by SOME_PASSWORD
default tablespace USERS
temporary tablespace TEMP;

REM  Using identified externally
create user OPS$FARMER
identified externally
default tablespace USERS
temporary tablespace TEMP;

//执行ORAPWD
ORAPWD FILE=filename PASSWORD=password ENTRIES=max_users

create role APPLICATION_USER;
grant CREATE SESSION to APPLICATION_USER;
create role DATA_ENTRY_CLERK;
grant select, insert on THUMPER.EMPLOYEE to DATA_ENTRY_CLERK;
grant select, insert on THUMPER.TIME_CARDS to DATA_ENTRY_CLERK;
grant select, insert on THUMPER.DEPARTMENT to DATA_ENTRY_CLERK;
grant APPLICATION_USER to DATA_ENTRY_CLERK;
grant DATA_ENTRY_CLERK to MCGREGOR;
grant DATA_ENTRY_CLERK to BPOTTER with admin option;

//设置角色
set role DATA_ENTRY_CLERK;
set role NONE;

//回收权利:
revoke delete on EMPLOYEE from PETER;
revoke all on EMPLOYEE from MCGREGOR;

//回收角色:
revoke ACCOUNT_CREATOR from HELPDESK;

drop user USERNAME cascade;

grant SELECT on EMPLOYEE to MCGREGOR with grant option;
grant SELECT on THUMPER.EMPLOYEE to BPOTTER with grant option;
revoke SELECT on EMPLOYEE from MCGREGOR;

create user MCGREGOR identified by VALUES ’1A2DD3CCEE354DFA’;
alter user OPS$FARMER identified by VALUES ’no way’;

//备份与恢复
使用 export 程序
exp system/manager file=expdat.dmp compress=Y owner=(HR,THUMPER)
exp system/manager file=hr.dmp owner=HR indexes=Y compress=Y
imp system/manager file=hr.dmp full=Y buffer=64000 commit=Y

//备份表
exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES)
//备份分区
exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES:Part1)

//输入例子
imp system/manager file=expdat.dmp
imp system/manager file=expdat.dmp buffer=64000 commit=Y

exp system/manager file=thumper.dat owner=thumper grants=N
  indexes=Y compress=Y rows=Y
imp system/manager file=thumper.dat FROMUSER=thumper TOUSER=flower
  rows=Y indexes=Y