Oracle数据库的相关操作汇总

select*from v$database:查询当前名

select tablespace_name from dba_tablespaces:查看当前数据库的表空间

select*from all_tables where table_name like’%violation%’ 模糊查询表名 表名必须大写

oracle不同用户表空间的表进行关联的时候需要在表名前添加用户表空间名

eg :select*from jtxt.vehicle

select table_name from user_tables :查询oracle数据库中本用户下的所有表

oracle库与库之间是可以直接关联表的

select*from swry_new@gazhk bggr用户下查询gazhk数据库的表

select table_name, tablespace_name from dba_tables where tablespace_name =’system’

:查看表空间 (system) 下的所有表

select*from all_users:查看你能管理的所有用户

select*from user_users:查看当前用户信息

select*from user_tables: 查看当前用户下有那些表

select*from all_tables:查询当前用户下可以访问哪些表,访问自己和其他用户的

select*from dba_tables:查询当前数据库的所有的表

select object_name,object_id from user_objects whereinstr(object_name,’log’)>0 :查看名称中包含log字符的表

select object_name,created from user_objects where object_name=upper(‘&etl_config_20160523’)

:查看某表的创建时间

selectsum(bytes)/(1024*1024) as “size(m)” from user_segments where segment_name =upper(‘&api_user_evaluation’):查看某表的大小

select table_name,cachefrom user_tables whereinstr(cache,’y’)>0:查看放在oracle的内存里的表

select*from user_indexes orderby table_name:查看索引信息

select*from user_ind_columns where index_name =upper(‘&affiche_id_pk’):查看表中被索引的字段

selectsum(bytes)/(1024*1024)as “size(m)” from user_segments where segment_name =upper(‘&affiche_id_pk’) :查看索引的大小

select*from user_sequences:查看序列号

select*from user_views:查看视图的名称

createsynonym swry_new_tmp for swry_new@gazhk:创建同义词(同义词:不同用户下建一个同义词,即可访问不同用户下的表)

select*from swry_new_tmp:查询同义词创建的表

dropsynonym swry_new_tmp:删除同义词

select*from user_role_privs:查询当前用户的角色

select*from user_sys_privs:查看当前用户的权限

select*from user_tab_privs:查看当前用户的表级权限

select*from v$database:查询当前数据库名

select tablespace_name from dba_tablespaces:查看当前数据库的表空间

select*from all_tables where table_name like’%violation%’ 模糊查询表名 表名必须大写

oracle不同用户表空间的表进行关联的时候需要在表名前添加用户表空间名

eg :select*from jtxt.vehicle

select table_name from user_tables :查询oracle数据库中本用户下的所有表

oracle库与库之间是可以直接关联表的

select*from swry_new@gazhk bggr用户下查询gazhk数据库的表

select table_name, tablespace_name from dba_tables where tablespace_name =’system’

:查看表空间 (system) 下的所有表

select*from all_users:查看你能管理的所有用户

select*from user_users:查看当前用户信息

select*from user_tables: 查看当前用户下有那些表

select*from all_tables:查询当前用户下可以访问哪些表,访问自己和其他用户的

select*from dba_tables:查询当前数据库的所有的表

select object_name,object_id from user_objects whereinstr(object_name,’log’)>0 :查看名称中包含log字符的表

select object_name,created from user_objects where object_name=upper(‘&etl_config_20160523’)

:查看某表的创建时间

selectsum(bytes)/(1024*1024) as “size(m)” from user_segments where segment_name =upper(‘&api_user_evaluation’):查看某表的大小

select table_name,cachefrom user_tables whereinstr(cache,’y’)>0:查看放在oracle的内存里的表

select*from user_indexes orderby table_name:查看索引信息

select*from user_ind_columns where index_name =upper(‘&affiche_id_pk’):查看表中被索引的字段

selectsum(bytes)/(1024*1024)as “size(m)” from user_segments where segment_name =upper(‘&affiche_id_pk’) :查看索引的大小

select*from user_sequences:查看序列号

select*from user_views:查看视图的名称

createsynonym swry_new_tmp for swry_new@gazhk:创建同义词(同义词:不同用户下建一个同义词,即可访问不同用户下的表)

select*from swry_new_tmp:查询同义词创建的表

dropsynonym swry_new_tmp:删除同义词

select*from user_role_privs:查询当前用户的角色

select*from user_sys_privs:查看当前用户的系统权限

select*from user_tab_privs:查看当前用户的表级权限

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐