1.如何强制log swith?
alter System switch logfile;
2.temporary tablespace和permanent tablespace的区别?
temporary tablespace用于临时对象,例如排序结果;permanent tablespace用于存储“真实”的对象,例如表、回滚段。
3.给出两种相关约束?
主键和外键
4.解释$Oracle_home和$oracle_base的区别?
$oracle_home是Oracle的产品目录$Oracle_base是Oracle的根目录
5.如何判断数据库的时区?
select dbtimezone from dual;
6.解释function、procedure和package的区别?
function和procedure都是PL/SQL的代码集合,都是为了完成一个任务。procedure不需要返回值而function将返回一个值;package是一个为了完成一组商业功能的function和procedure的集合。
7.解释table function的用途?
table function是通过PL/SQL逻辑返回一组记录,它用于表或者视图。也可以用于pipeline或者etl过程。
8.当用户进程出错,哪个后台进程负责清理它?
pmon
9.描述什么是redo logs?
redo logs是用于存放数据库数据改动的物理和逻辑结构。用于恢复数据库。
10.创建数据库时,自动建立的tablespace的名称?
System tablespace
11.创建用户时,需要赋予用户什么权限才能使它连接上数据库?
connect
12. IMPORT和SQL*LOADER 这2个工具的不同点?
这两个ORACLE工具都是用来将数据导入数据库的。
区别是:IMPORT工具只能处理由另一个ORACLE工具EXPORT生成的数据。而SQL*LOADER可以导入不同的ASCII格式的数据源。更多Oracle教程视频请看http://www.cuug.com/
13.如何在tablespace里增加数据文件?
alter tablespace<tablespace_name> add datafile<datafile_name>size<size>;
14.如何变动数据文件的大小?
alter database datafile<datafile_name> resize<new_size>;
15.给出在star schema中的两种表及它们分别含有的数据?
fact tables和dimension tables。fact table主要包含大量的主要信息而dimension tables中存放着对fact table的某些属性描述的信息。
16.哪些View用来检查数据文件的大小?
dba_data_files
17.哪些View用来判断tablespace的剩余空间?
dba_free_space
18.如何重构索引?
alter index<index_name> rebuild;
19.fact table上需要建立何种索引?
位图索引(bitmap index)
20.解释什么是partition以及它的优点?
partition是将大表和者索引分割成更小的、易于管理的分区。
21.如何在不影响子表的前提下,重建母表?
使子表的外键强制失效,重建母表,激活外键
22. 去除重复记录
delete from t_insure_feed where user_id in (select user_id from t_insure_feed group by user_id having count(*)>1);
23.如何删除大表
delete from table_name where 。。。;
如果要清除全部数据,truncate table tab_name;速度最快
24.如何快速删除一列
alter table t_objects set unused (timestamp); 很快,瞬间
--this clause does not remove column data.
alter table t_objects drop column timestamp checkpoint 100; 次之
--Checkpointing cuts down the amount of undo
logs accumulated during the DROP COLUMN
operation to avoid running out of undo space.
alter table t_objects drop column timestamp;很慢
40.如何消除表和索引的碎片
table
(1)shrink (会自动维护其上索引,不需再rebuild)
alter table t_objects enable row movement;
alter table t_objects shrink space compact cascade;
(2)exp/imp
expdp/impdp
(3)CTAS
(4)alter table emp move; 重新创建,类似ctas
index
alter index index_name rebuild;
create table re (id number,name varchar2(10));
insert into re values(1,'1');
insert into re values(1,'1');
insert into re values(1,'1');
insert into re values(2,'1');
insert into re values(2,'1');
commit;
create table re1
as
select id,name from re group by id,name;
rename re to re2;
rename re1 to re;
delete from re where rowid in
(select a.rowid from re a, re b
where a.rowid>b.rowid and a.id=b.id and
a.name=b.name)