Oracle基础练习四
为表空间my_tbs_1在oracle目录下增加一个20M的数据文件my_tbs_1_02.dbf。
alter tablespace my_tbs_1
add datafile '/home/shiyanlou/oracle/my_tbs_1_02.dbf'
size 20 M;
select file_name , tablespace_name from dba_data_files;
将my_tbs_1_02.dbf的容量扩展为100M。
alter database
datafile '/home/shiyanlou/oracle/my_tbs_1_02.dbf'
resize 100 M;
将已经创建的表空间My_tbs_1中的数据文件my_tbs_1_01.dbf设置为自动扩展,每次5M,最大100M。
alter database
datafile '/home/shiyanlou/oracle/my_tbs_1_01.dbf'
autoextend on next 5 M
maxsize 100 M;
取消my_tbs_1_01.dbf的自动扩展。
alter database
datafile '/home/shiyanlou/oracle/my_tbs_1_01.dbf'
autoextend off ;
删除表空间my_tbs_1,并查看对应的数据文件还在不在。
drop tablespace my_tbs_1 including contents;
host ls oracle
在database目录下创建表空间,名字为zzxy,对应数据文件为zzxy.dbf,然后删除表空间的同时删除它所对应的数据文件,查看数据文件还在不在。
create tablespace zzxy
datafile '/home/shiyanlou/database/zzxy.dbf'
size 20 M
extent management local ;
drop tablespace zzxy including contents and datafiles;
host ls database
删除表空间zzxy中的数据文件‘/home/shiyanlou/database/zzxy_02.dbf’。
alter tablespace zzxy
drop datafile '/home/shiyanlou/database/zzxy_02.dbf' ;
select file_name , tablespace_name from dba_data_files;
整个数据库备份及恢复
使用rman
shutdown immediate
startup mount
alter database archivelog
host rman
connect target sys/ Syl12345
backup database ;
restore database ;
recover database ;
单独表空间备份
backup tablespace zzxy;
restore tablespace zzxy;