oracle10g基础管理

修改参数
alter system set control_files=
'C:\DATABASE\disk4\orcl\CONTROL01.CTL',
'C:\DATABASE\disk5\orcl\CONTROL02.CTL',
'C:\DATABASE\disk6\orcl/\CONTROL03.CTL' scope=spfile;
复制文件
host copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL C:\DATABASE\disk4\orcl\CONTROL01.CTL;
host copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL C:\DATABASE\disk5\orcl\CONTROL02.CTL;
host copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL C:\DATABASE\disk6\orcl\CONTROL03.CTL;

增加日志组:
alter database add logfile group 3
('C:\DATABASE\disk4\orcl\redo03A.log',
'C:\DATABASE\disk5\orcl\redo03B.log',
'C:\DATABASE\disk6\orcl\redo03C.log')
size 15m;

增加日志文件:
alter database add logfile member
'C:\DATABASE\DISK4\ORCL\REDO01c.LOG' to group 2,
'C:\DATABASE\DISK5\ORCL\REDO02c.LOG' to group 2,
'C:\DATABASE\DISK6\ORCL\REDO03c.LOG' to group 2;

建立普通表空间:
create tablespace dog_data
datafile 'C:\DATABASE\disk1\orcl\dog_data.dbf'
size 50m
extent management local
uniform size 1m
segment space management auto;

建立索引表空间:
create tablespace dog_index
datafile 'C:\DATABASE\disk2\orcl\dog_index.dbf'
size 50m
extent management local
uniform size 1m
segment space management auto;

建立还原表空间:
create undo tablespace orcl_undo
datafile 'C:\DATABASE\disk3\orcl\dog_undo.dbf'
size 50m
extent management local;

建立临时表空间:
create temporary tablespace orcl_temp
tempfile 'C:\DATABASE\disk3\orcl\dog_temp.dbf'
size 50m
extent management local
uniform size 1m;

增加新的数据文件到表空间:
alter tablespace dog_data
add datafile 'C:\DATABASE\DISK1\ORCL\DOG_DATA02.DBF'
size 50m


移动非表空间:
host copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF C:\DATABASE\disk3\orcl
host copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF C:\DATABASE\disk3\orcl

修改参数:
alter tablespace users rename
datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF'
to 'C:\DATABASE\disk3\orcl\USERS01.DBF'

alter tablespace undotbs1 rename
datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF'
to 'C:\DATABASE\disk3\orcl\UNDOTBS01.DBF'


移动系统表空间:

host copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF C:\DATABASE\disk3\orcl
host copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF C:\DATABASE\disk3\orcl

修改参数:
alter database rename
file 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
to 'C:\DATABASE\disk3\orcl\SYSTEM01.DBF'

alter database rename
file 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF'
to 'C:\DATABASE\disk3\orcl\SYSAUX01.DBF'


修改用户表空间配额:
alter user dog
identified by dog
default tablespace dog_data
temporary tablespace orcl_temp--不能在临时表空间上分配配额
quota 10m on dog_data
password expire;

建普通表:
create table student
(sno varchar2(12),
sname varchar2(6),
sphone varchar2(11)
)tablespace dog_data;

建立索引:
create index dog.student_index
on dog.student(sno)
pctfree 20
storage(initial 100k next 100k
pctincrease 0 maxextents 100)
tablespace dog_index;

增加新的一列:
alter table dog.student
add sphone varchar2(11);

建立临时表:
create global temporary table dog.student_temp
on commit preserve rows
as
select * from student;

你可能感兴趣的:(oracle10g)