10.查表空间磁盘参数
ACCEPT sth PROMPT '请输入要查看的表空间名:'
col tablespace_name for a15
select tablespace_name,initial_extent,next_extent,max_extents,pct_increase,min_extlen
from dba_tablespaces
where lower (tablespace_name) like '%&sth%'
/
11.查表空间的类型
ACCEPT sth PROMPT '请输入要查询的表空间名称:'
select tablespace_name,status,contents
from dba_tablespaces
where lower(tablespace_name) like '%&sth%'
/
12.查表空间对应的数据文件
ACCEPT sth PROMPT '请输入要查询表空间的名称:'
col file_name for a30
select tablespace_name,file_id,file_name,autoextensible
from dba_data_files
where lower(tablespace_name) like '%&sth%'
/
13.查对象创建日期
ACCEPT object_name PROMPT '请输入对象名(table,view,index,sequence,synonym):'
select object_name,object_type,created,last_ddl_time,status
from user_objects
where lower(object_type)= '&object_name'
/
14.查临时表空间对应的数据文件
col file for a30
col tablespace for a25
select f.file#,t.ts#,f.name "File",t.name "Tablespace"
from v$tempfile f,V$tablespace t
where f.ts# = t.ts#
/
15.查默认表空间
col property_name for a20
col property_value for a20
col description for a20
select *
from database_properties
where property_name like 'DEFAULT%'
/
16.查同义词信息
select synonym_name,table_owner,table_name
from user_synonyms
/
17.查序列号信息
select sequence_name,min_value,max_value,increment_by,last_number
from user_sequences
/
18.查用户下的所有表
select table_name from user_tables
/
19.创表空间
ACCEPT tablespace_name PROMPT '请输入要创建的表空间名称:'
ACCEPT add PROMPT '请输入数据文件地址:'
ACCEPT size PROMPT '请输入数据文件大小:'
ACCEPT usize PROMPT '请输入区段extent的大小:'
create tablespace &tablespace_name
datafile '&add'
size &size
extent management local
uniform size &usize
/
20.创还原表空间
ACCEPT sth1 PROMPT '请输入要创建还原表空间名称:'
ACCEPT sth2 PROMPT '请输入数据文件地址:'
ACCEPT sth3 PROMPT '请输入数据文件大小:'
create undo tablespace &sth1
datafile '&sth2'
size &sth3
/
21.创临时表空间
ACCEPT sth1 PROMPT '请输入要创建临时表空间名称:'
ACCEPT sth2 PROMPT '请输入临时数据文件地址:'
ACCEPT sth3 PROMPT '请输入临时数据文件大小:'
ACCEPT sth4 PROMPT '请输入区段extent的大小:'
create temporary tablespace &sth1
tempfile '&sth2'
size &sth3
extent management local
uniform size &sth4
/
22.创同义词
ACCEPT s PROMPT '请输入简称:'
ACCEPT sss PROMPT '请输入要替代的名称:'
create synonym &s
for &sss
/
23.创序列号
ACCEPT sequence_name PROMPT '请输入序列号名:'
ACCEPT start_number PROMPT '请输入开始数目:'
ACCEPT increment_number PROMPT '请输入增幅:'
ACCEPT maxvalue PROMPT '请输入能增长的最大值:'
create sequence &sequence_name
start with &start_number
increment by &increment_number
maxvalue &maxvalue
nocycle
/
24.改默认临时表空间
ACCEPT sth PROMPT '请输入默认临时表空间为:'
alter database default temporary tablespace &sth
/
25.改数据文件为自动扩展
ACCEPT sth1 PROMPT '请输入要扩展的完整的文件名:'
alter database datafile
'&sth1' autoextend on
next 1M
/
26.改序列号增幅
ACCEPT name PROMPT '请输入要改的序列号名:'
ACCEPT increment PROMPT '请输入修改后的增幅为:'
alter sequence &name
increment by &increment
/
27.改序列号最大值
ACCEPT name PROMPT '请输入要改的序列号名:'
ACCEPT maxvalue PROMPT '请输入修改后的最大值为:'
alter sequence &name
maxvalue &maxvalue
/
28.改序列号最小值
ACCEPT name PROMPT '请输入要改的序列号名:'
ACCEPT minvalue PROMPT '请输入修改后的最小值为:'
alter sequence &name
minvalue &minvalue
/
29.删表空间
ACCEPT sth1 PROMPT '请输入要删除表空间名:'
drop tablespace &sth1
/
30.删表空间及数据文件
ACCEPT sth1 PROMPT '请输入要删除的表空间名称(包括数据文件):'
drop tablespace &sth1 including contents and datafiles
/
31.删同义词
ACCEPT s PROMPT '请输入要删除同义词名:'
drop synonym &s
/
32.删序列号
ACCEPT sequence_name PROMPT '请输入要删除序列号名:'
drop sequence &sequence_name;
09-30
2391
12-14
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交