Oracle系统表查询
数据字典dict总是属于Oracle用户sys的。
1、用户:
select username from dba_users;
改口令
alter user spgroup identified by spgtest;
2、表空间:
select * from dba_data_files;
select * from dba_tablespaces;//表空间
select tablespace_name,sum(bytes), sum(blocks)
from dba_free_space group by tablespace_name;//空闲表空间
select * from dba_data_files
where tablespace_name=’RBS’;//表空间对应的数据文件
select * from dba_segments
where tablespace_name=’INDEXS’;
3、数据库对象:
select * from dba_objects;
CLUSTER、DATABASE LINK、FUNCTION、INDEX、LIBRARY、PACKAGE、PACKAGE BODY、
PROCEDURE、SEQUENCE、SYNONYM、TABLE、TRIGGER、TYPE、UNDEFINED、VIEW。
4、表:
select * from dba_tables;
analyze my_table compute statistics;->dba_tables后6列
select extent_id,bytes from dba_extents
where segment_name=’CUSTOMERS’ and segment_type=’TABLE’
order by extent_id;//表使用的extent的信息。segment_type=’ROLLBACK’查看回滚段的空间分配信息
列信息:
select distinct table_name
from user_tab_columns
where column_name=’SO_TYPE_ID’;
5、索引:
select * from dba_indexes;//索引,包括主键索引
select * from dba_ind_columns;//索引列
select i.index_name,i.uniqueness,c.column_name
from user_indexes i,user_ind_columns c
where i.inde
相关文档:
例:
create user his identified by his default tablespace users temporary tablespace temp;
grant connect,resource,dba to his;
create tablespace his
logging
datafile 'd:\oracle\product\10.2.0\oradata\zjxsh\his.ora' size 100M extent
management local segment space management auto;
exp his/ny@ny ......
<1>逻辑备份
不用去拷贝数据库的物理文件
备份逻辑上的结构
外部的工具:导出和导入的工具
DOS下的命令 cmd下执行
导出exp export缩写形式
查看帮助 exp help=y
使用参数文件导出
exp parfile=c:\ab ......
Oracle的分页查询语句基本上可以按照本文给出的格式来进行套用。
分页查询格式:
SELECT * from
(
SELECT A.*, ROWNUM RN
from (SELECT * from TABLE_NAME) A
WHERE ROWNUM <= 40
)
WHERE RN >= 21
其中最内层的查询SELECT * from TABLE_NAME表示不进行翻页的原始查询语句。ROWNUM <= 40和RN >= 21 ......
初始化相关参数job_queue_processes
alter system set job_queue_processes=39 scope=spfile;//最大值不能超过1000 ;job_queue_interval = 10 //调度作业刷新频率秒为单位
job_queue_process 表示oracle能够并发的job的数量,可以通过语句
show parameter job_queue_process;
来查看oracle中job_queue_process的值� ......
对于rownum来说它是oracle系统顺序分配为从查询返回的行的编号,返回的第一行分配的是1,第二行是2,依此类推,这个伪字段可以用于限制查询返回的总行数,而且rownum不能以任何表的名称作为前缀。
举例说明:
例如表:student(学生)表,表结构为:
ID char(6) --学号
name VA ......