oracle用户权限管理.docx
《oracle用户权限管理.docx》由会员分享,可在线阅读,更多相关《oracle用户权限管理.docx(14页珍藏版)》请在冰豆网上搜索。
oracle用户权限管理
实验二:
用户权限管理与测试
实验环境:
操作系统:
windowsXP软件版本:
oracle9i
实验内容:
用户权限管理与测试
实验要求:
(1)先用二维表的形式画出各个用户与其权限的关系以及对应默认的表空间(默认表空间参看实验一的内容需求)
(2)根据上述要求创建以上所有用户、授予其相应权限并指定相应默认的表空间以及用户的缺省状态。
请写出完整、具体的SQL语句。
(3)设计测试案例。
创建完成后,进行实际测试,以测试其有效性。
以实际环境的截图为准。
实验步骤:
一、各个用户与其权限的关系以及对应默认的表空间如下表:
权限
用户
系统权限
对象权限
默认的表空间
用户缺省状态
(锁定/未锁定)
syssecur_user
UNLIMITTABLESPACE
CREATEUSERALTERUSERDORPUSER
-----
User
未锁定
DBrestore_user
BACKUP
UNLIMITTABLESPACE
------
User
未锁定
DBbkp_user
FALSHBACK
UNLIMITTABLESPACE
------
User
未锁定
Teamuser
UNLIMITTABLESPACE
IDUS
Tbs_team_data
未锁定
audituser
UNLIMITTABLESPACE
IDUS
Tbs_pretreat_data
未锁定
inneruser
UNLIMITTABLESPACE
S
Tbs_postdata_data1
未锁定
说明:
I—INSERT;D---Delete;U----Update;S----Select
二、用户创建、授权并指定相应默认的表空间以及用户的缺省状态:
(1)作业小队(teamuser):
创建:
CREATEUSER"TEAMUSER"PROFILE"DEFAULT"
IDENTIFIEDBY"teamuser123"DEFAULTTABLESPACE
"TBS_TEAM_DATA"
TEMPORARYTABLESPACE"TBS_TEAM_TEMP"
ACCOUNTUNLOCK;
GRANT"CONNECT"TO"TEAMUSER"WITHADMINOPTION;
GRANT"RESOURCE"TO"TEAMUSER"WITHADMINOPTION;
授权:
GRANTDELETEON"TEAMUSER"."OPERATION_INFOR"TO"TEAMUSER"
GRANTINSERTON"TEAMUSER"."OPERATION_INFOR"TO"TEAMUSER"
GRANTSELECTON"TEAMUSER"."OPERATION_INFOR"TO"TEAMUSER"
GRANTUPDATEON"TEAMUSER"."OPERATION_INFOR"TO"TEAMUSER"
(2)数据审核部门(audituser):
创建:
CREATEUSER"AUDITUSER"PROFILE"DEFAULT"
IDENTIFIEDBY"audituser"DEFAULTTABLESPACE
"TBS_PRETREAT_DATA"
TEMPORARYTABLESPACE"TBS_PRETREAT_TEMP"
ACCOUNTUNLOCK;
GRANT"CONNECT"TO"AUDITUSER"WITHADMINOPTION;
GRANT"RESOURCE"TO"AUDITUSER"WITHADMINOPTION;
授权:
GRANTDELETE
ON"AUDITUSER"."TAB_PRETREATDATA"TO"AUDITUSER"
GRANTDELETEON"TEAMUSER"."OPERATION_INFOR"TO"AUDITUSER"
GRANTINSERTON"AUDITUSER"."TAB_POSTDATA"TO"AUDITUSER"
GRANTINSERTON"AUDITUSER"."TAB_PRETREATDATA"TO"AUDITUSER"
GRANTSELECTON"AUDITUSER"."TAB_POSTDATA"TO"AUDITUSER"
GRANTSELECTON"AUDITUSER"."TAB_PRETREATDATA"TO"AUDITUSER"
GRANTSELECTON"TEAMUSER"."OPERATION_INFOR"TO"AUDITUSER"
GRANTUPDATEON"AUDITUSER"."TAB_PRETREATDATA"TO"AUDITUSER"
(3)公司内部用户(inneruser):
创建:
CREATEUSER"INNERUSER"PROFILE"DEFAULT"
IDENTIFIEDBY"inneruser123"DEFAULTTABLESPACE
"TBS_POSTDATA_DATA1"
TEMPORARYTABLESPACE"TBS_POSTDATA_TEMP"
ACCOUNTUNLOCK;
GRANT"CONNECT"TO"INNERUSER"WITHADMINOPTION;
GRANT"RESOURCE"TO"INNERUSER"WITHADMINOPTION;
授权:
GRANTSELECTON"AUDITUSER"."TAB_POSTDATA"TO"INNERUSER"
(4)外部用户(webuser):
创建:
CREATEUSER"WEBUSER"PROFILE"DEFAULT"
IDENTIFIEDBY"webuser123"DEFAULTTABLESPACE
"TBS_POSTDATA_DATA1"
TEMPORARYTABLESPACE"TBS_POSTDATA_TEMP"
ACCOUNTUNLOCK;
GRANT"CONNECT"TO"WEBUSER"WITHADMINOPTION;
GRANT"RESOURCE"TO"WEBUSER"WITHADMINOPTION;
授权:
GRANTSELECT
ON"AUDITUSER"."TAB_POSTDATA"TO"WEBUSER"
(5)数据库备份管理员(DBbkp_user)创建及授权:
CREATEUSER"DBBKP_USER"PROFILE"DEFAULT"
IDENTIFIEDBY"DBbkp_user123"DEFAULTTABLESPACE"USERS"
ACCOUNTUNLOCK;
GRANTBACKUPANYTABLETO"DBBKP_USER"WITHADMINOPTION
GRANTUNLIMITEDTABLESPACETO"DBBKP_USER"WITHADMINOPTION;
GRANT"CONNECT"TO"DBBKP_USER"WITHADMINOPTION;
GRANT"RESOURCE"TO"DBBKP_USER"WITHADMINOPTION;
(6)数据库恢复管理员(DBrestore_user)创建及授权:
CREATEUSER"DBRESTORE_USER"PROFILE"DEFAULT"
IDENTIFIEDBY"DBrestore_user123"DEFAULTTABLESPACE"USERS"
ACCOUNTUNLOCK;
GRANTFLASHBACKANYTABLETO"DBRESTORE_USER"WITHADMINOPTION
GRANTUNLIMITEDTABLESPACETO"DBRESTORE_USER"WITHADMINOPTION
GRANT"CONNECT"TO"DBRESTORE_USER"WITHADMINOPTION;
GRANT"RESOURCE"TO"DBRESTORE_USER"WITHADMINOPTION;
(7)数据库安全管理员(syssecur_user)创建及授权:
CREATEUSER"SYSSECUR_USER"PROFILE"DEFAULT"
IDENTIFIEDBY"syssecur_user123"DEFAULTTABLESPACE"USERS"
ACCOUNTUNLOCK;
GRANTALTERUSERTO"SYSSECUR_USER"WITHADMINOPTION
GRANTCREATEUSERTO"SYSSECUR_USER"WITHADMINOPTION
GRANTDROPUSERTO"SYSSECUR_USER"WITHADMINOPTION
GRANT"CONNECT"TO"SYSSECUR_USER"WITHADMINOPTION;
GRANT"RESOURCE"TO"SYSSECUR_USER"WITHADMINOPTION;
二、测试案例:
作业小队(teamuser)测试:
连接到teamuser用户:
ConnectTEAMUSER/teamuser123
(1)向OPERATION_INFOR表中插入测试数据:
INSERTINTO"TEAMUSER"."OPERATION_INFOR"("PLACEID","MACHINEID","TEAMID","CLIENT_ID","WORKDATE","WORKTIME","DEEEPTH_PARA","AVERAGE_FLOW","AVERAGE_DENSITY","AVERAGE_PRESSURE","PRESSURE_MAX","AVERAGE_SPEED","SPEED_MAX","ESTIMATE_TIME")
VALUES('CSJCT01','M01','Z01','WRC01',TO_DATE('24-04-2011','dd-MM-yyyyHH:
MI:
SSAM'),TO_DATE('10:
10:
10','dd-MM-yyyyHH:
MI:
SSAM'),10,10,10,10,10,10,10,10);
(2)查询表中数据:
ConnectTEAMUSER/teamuser123
SELECT*FROMOPERATION_INFOR;
(3)更新表中数据:
UPDATE"TEAMUSER"."OPERATION_INFOR"
SETTEAMID=‘M02’;
(4)删除表中数据:
DELETEFROM"TEAMUSER"."OPERATION_INFOR";
数据审核部门(audituser)测试:
连接到audituser用户:
ConnectAUDITUSER/audituser
(1)向TAB_PRETREATDATA表中插入数据:
INSERTINTO"AUDITUSER"."TAB_PRETREATDATA"
("PLACEID","MACHINEID","TEAMID","CLIENT_ID",
"WORKDATE","WORKTIME","DEEEPTH_PARA","AVERAGE_FLOW",
"AVERAGE_DENSITY","AVERAGE_PRESSURE","PRESSURE_MAX",
"AVERAGE_SPEED","SPEED_MAX","ESTIMATE_TIME")
VALUES('CSJCT01','M01','Z01','WRC01',
TO_DATE('24-04-2011','dd-MM-yyyyHH:
MI:
SSAM'),
TO_DATE('10:
10:
10','dd-MM-yyyyHH:
MI:
SSAM'),10,10,10,10,10,10,10,10);
(2)向TAB_POSTDATA表中插入数据:
INSERTINTO"AUDITUSER"."TAB_POSTDATA"
("PLACEID","MACHINEID","TEAMID","CLIENT_ID",
"WORKDATE","WORKTIME","DEEEPTH_PARA","AVERAGE_FLOW",
"AVERAGE_DENSITY","AVERAGE_PRESSURE","PRESSURE_MAX",
"AVERAGE_SPEED","SPEED_MAX","ESTIMATE_TIME")
VALUES('CSJCT01','M01','Z01','WRC01',
TO_DATE('24-04-2011','dd-MM-yyyyHH:
MI:
SSAM'),
TO_DATE('10:
10:
10','dd-MM-yyyyHH:
MI:
SSAM'),10,10,10,10,10,10,10,10);
(3)查询表中数据:
ConnectAUDITUSER/audituser
SELECT*FROMTAB_PRETREATDATA;
(4)更新表中数据:
UPDATE"AUDITUSER"."TAB_PRETREATDATA"
SETTEAMID=‘M02’;
(5)删除表中数据:
DELETEFROM"AUDITUSER"."TAB_PRETREATDATA";
数据库安全管理员(syssecur_user)测试:
连接到syssecur_user管理员:
ConnectSYSSECUR_USER/syssecur_user123ASSYSDBA
(1)删除数据库备份管理员(DBbkp_user):
dropuserDBBKP_USERcascade;
(2)重新创建数据库备份管理员(DBbkp_user)及授权:
CREATEUSER"DBBKP_USER"PROFILE"DEFAULT"
IDENTIFIEDBY"DBbkp_user123"DEFAULTTABLESPACE"USERS"
ACCOUNTUNLOCK;
GRANTBACKUPANYTABLETO"DBBKP_USER"WITHADMINOPTION;
GRANTUNLIMITEDTABLESPACETO"DBBKP_USER"WITHADMINOPTION;
GRANT"CONNECT"TO"DBBKP_USER"WITHADMINOPTION;
GRANT"RESOURCE"TO"DBBKP_USER"WITHADMINOPTION;
(3)查询所有信息:
DESCALL_USERS;