oracle期末考试试题
中国人民解放军军械工程学院-济南公务员考试网
1. 如何启动实例、如何装载数据库,如何打开数据库。
Startup
nomount alter database mount alter database
open
Startup mount
Startup
2.
如何禁止用户的操作系统认证 禁止之后,怎么登录?
修改 nts
3.
如何控制用户不可以远程登陆。
Alter system set
remote_login_passwordfile=exclusive none
Comment=’2009-12-14’
Scope=spfile;
4.
syssias@orcl as sysdba 中orcl的解析
5. 修改服务器端orcl
的监听端口。
6. 创建密码文件。
$$orapwd file='e:'
Passwd=nzg entries=30;
7. 怎么样从spfile生成pfile
Create pfile=’d:’ from spfile;
Create
spfile=’e:’ form pfile=’d:’;
8.
通过参数文件查看控制文件的位置
Show parameter
control_file; select name from
v$$controlfile;(在例程连接数据库后
Mount可执行)。
可通过以下几个动态数据字典视图中获得有关控制文件的信息
V$$controlfile
v$$database V$$controlfile_record_section
Select name from v$$database; 显示数据库名称。
9.
为控制文件产生一个跟踪文件
Alter database backup
controlfile to trace;
该文件在
D:oracleproduct10.2.0adminorcludump
可通过 show parameter user_dump_dest;查看目录。
10. 创建表空间new,默认的对象存储参数为initial为500k,next为100
k,minextents
为1,maxextents为50,pctincrease为0
Create tablespace new
Datafile ‘d:’ size 10m
Default storage
(initial 500k
Next 100k
Minextents 1
Maxextents 50
Pctincrease 0);
11.
创建表空间newtbs,将数据库的默认表空间改为newtbs
Create
tablespace newtbs
Datafile ‘d:’ size 10m;
Alter database default tablespace newtbs;
12. 创建临时表空间temptbs,将数据库的默认临时表空间改为temptbs
Create temporary tablespace temptbs
tempfile ‘e:’ size 10m;
Alter database
default temporary tablespace temptbs;
13.
创建表空间tt,并且使它在创建后联机,之后再修改为脱机
Create tablespace
tt
Datafile ‘d:’ size 10m online;
Alter
tablespace tt offline;
14. 创建本地管理的表空间a
a,建表test并将表放入表空间aa中,然后删除该表空间
以及对应的数据文件
Create tablespace aa
Datafile ‘d:’ size
10m
Extent management local
autoallocate;
Create table test
(aa int, bb int) tablespace aa;
Drop
tablespace aa including contents (cascade
constraints约束);
15. 创建表空间bb,对应的数据文件为2个
Create tablespace bb
Datafile ‘d:’ size
10m ,
‘e:’ size 5m;'
16.
创建表空间cc,然后将其数据文件移动到另外一个文件夹中
tablespace cc
Datafile ‘d:’ size 10m;
tablespace cc
offline;
3.$$copy d: e:
tablespace cc
Rename datafile ‘d:’ to ‘e:’;
tablespace
cc online;
######数据文件脱机
log_mode
From v$$database; 数据文件只能在noarchivelog模式下脱机
database
Datafile ‘e:’ offline drop;
3.Recover datafile ‘e:’; 介质恢复之后才能联机
4.
alter database datafile ‘e:’ online;
17.
创建大文件表空间,大小为10m
Create bigfile tablespace dd
Datafile ‘d:’ size 10m;
18.
创建本地管理的表空间ee,统一分配大小为10m
Create tablespace ee
Datafile ‘d:’ size 100m
Extent management
local uniform size 10m;(有、无都对)
19.
创建表空间hh,采用自动段空间管理
Create tablespace hh
Datafile ‘d:’ size 10m reuse
Segment space management auto
20.
查看日志操作模式,改变数据库的归档模式为archivelog
Select log_mode
From v$$database;
shutdown immediate
startup mount
alter database archivelog;
alter database open;
21.
查看日志文件以及日志文件组的信息
Select group# ,member
From v$$logfile; 查看文件位置
Select group#
,status
From v$$log; 查看状态
22.
添加日志文件组,然后删除新添加的日志文件组
Alter database
Add logfile (‘d:’) size 10m;
Alter
database
Drop logfile (‘d:’);
#######添加日志组成员:
Alter database
Add
logfile member ‘e:’ to group 1;
######删除日志组成员
Alter system switch logfile;
Alter
database
Drop logfile member ‘e:’;
23. 手工切换日志
Alter system switch logfile;
24. 任意创建一个表,采用区间分区
Create table RR
(range_col data,
Aa int)
Partition by range(range_col)
(partition part1 values less than
(to_date(‘01012009’,’ddmmyyyy’)),
Partition
part2 values less than
(to_date(‘01012009’,’ddmmyyyy’)),
Partition
part3 values less than(maxvalue));
25.
任意创建一个表,采用散列分区
Create tablespace p1
Datafile ‘d:’ size 10m
Create tablespace
p2
Datafile ‘d:’ size 10m;
Create table
hash_t
(hh int,
Bb int )
Partition by hash(hh)
(Partition part1
tablespace p1,
Partition part2 tablespace
p2);
26. 任意创建一个表,采用列表分区
Create table list_t
(list_col
varchar2(20),
Bb int)
Partition by
list(list_col)
(partition part1
values(‘wo’,’de’,’en’),
Partition part2
values(‘zhao’,’gong’,’zuo’),
Partition part3
values(‘yao’,’cheng’,’hao’));
27.
任意创建一个表,采用组合分区
Create table com
(rr int,
hh int, cc int)
Partition by range (rr)
Subpartition by hash(hh) subpartitions 2
(partition part1 values less than (10)
(subpartition part1_sub1 -----tablespace p1 ,
后面这个tablespace加不加都可以的
Subpartition
part1_sub2 ------tablespace p2),
Partition
part2 values less than (20)
(subpartition
part2_sub1 ------tablespace p1,
Subpartition
part2_sub2------tablespace p2));
28. 创建用户u1,默认表空间为test,第一次登陆必须修改密码
Create
user u1 identified by u1
default tablespace
test
password expire;
29.
创建用户u2,将其锁定,然后解锁
Create user u2 identified by
u2;
Alter user u2 account lock;
Alter user
u2 account unlock;
30.
创建用户u3,为它分配系统权限,能够连接数据库,并能创建表
Create user u3
identified by u3
Grant create session ,create
table to u3;
31.
创建用户u4,为它分配连接数据库的权限,并允许它能将此权限分配给其它用
户
Create user u4 identified by u4
Grant
create session to u4
With admin option;
32.
创建用户u5,为它分配查询,更新表test的权限,并允许它将此权限分配给其它
用户
Create user u5 identified by u5;
Grant
select,update on test to u5
With grant option;
33. 撤销用户u5的查询和更新权限
Revoke select
,update on test from u5;
34.
创建用户u6,能查看修改TEST中的aa 列。
Create user u6
identified by u6;
Grant select ,update (aa) on
test to u6;
35. 创建用户u1,创建角色r1,r2,其中r2
密码为r2,将角色r1 r2 授权给u1
Create role r1 not
identified;
Create role r2 identified by r2
Grant r1,r2 to u1;
36.
给r1授权为create session,以及查询sys方案中的表test,给r2授权,修改sys
方
案中的test表
37. 修改用户u1,默认角色为r1
Alter user u1 default role r1;
38.
u1想修改sys方案中的test,激活r2,修改后禁止r2角色
set role r2
identified by r2;
update set aa=aa+100;
set role all except r2;
39.
创建用户u2,允许密码修改3次,密码锁定10天
Create user u2
identified by u2;
Create profile p1
Limit
Failed_login_attempts 3
Password_lock_time
10;
Alter user u2 profile p1;
40. 创建用户u3,允许密码使用5天,5天后必须修改密码,并且密码与前密码不
同
Create user u3 identified by u3
Create
profile p2
Limit
Password_life_time 5
Password_grace_time 5
Password_reuse_max
unlimited;
Alter user u3 profile p2;
41. 创建用户u4,口令使用校验函数verify_function
@
d:oracleproduct10.2.0db_;
Create profile p4
Limit
Password_verify_function
verify_function;
Create user u4 identified by
user123#;
42. 激活资源限制
Alter
system set resource_limit=true;
43.
用profile管理会话资源,限制会话数为3,并将该限制分配给u5
Create
profile session_limit
Limit
Sessions_per_user 3;
Alter user u5 profile
session_limit;
44.
new用户下有表newtb,存在另一个用户u1,授权u1 可以查看,修改和删除
new
用户下的newtb,审计u1 对new用户下的newtb表的修改动作,并查看。
Show
parameter audit_sys_operations;
Alter system
set audit_sys_operations=true scope=spfile;
Show parameter audit_trail;
Alter system
set audit_trail=true scope=spfile;
重启数据库。
Create user new identified by new123#
Default tablespace users
Quota 2m on users;
Grant create session,create table to new;
以new身份Create table newtb
(aa int,
bb int);
以sys身份Grant select, update,delete on
to u1;(为什么new什么不能授
权???
Conn