网站首页 > 文章中心 > 其它

oracle怎么查表引用

作者:小编 更新时间:2023-09-28 19:14:26 浏览量:371人看过

ORACLE中,如何根据已知的主键查询所有引用这个主键的外键的表

oracle怎么别的库中表引用

有两种方法...

oracle怎么查表引用-图1

一种是在sqlplus里

先连接本地数据库...

copy from ###/###@### to $$$/$$$@$$$

这种方法适合小额数据的迁移,只能在SQL*PLUS中运行.

###/###@### --本地数据库

$$$/$$$@$$$ --想引用的别的库

另一种是:

DBA负责创建数据库链接.字典视图USER_DB_LINKS包含有关用户可以访问的链接信息.

语法:

CREATE PUBLIC DATABASE LINK link_name

CONNECT TO USER_NAME IDENTIFIED BY PASSWORD

其中:

PUBLIC 指定数据库链接的OWNER为PUBLIC,即公用的数据库链接

CONNECT TO 要用来链接的用户名和密码

例:

create public database link testlink

connect to system identified by system

说明:

可通过user_db_links来查看已有的数据库链接

oracle 怎么查看索引被引用

①.、通过PL/SQL可以直接查看某表是否建索引

where table_name='表名'

oracle怎么查询所有的表?有没有主键?

①.、查找表的所有索引(包括索引名,类型,构成列):

select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表

select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' and au.table_name = 要查询的表

select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'U' and au.table_name = 要查询的表

select * from user_constraints c where c.constraint_type = 'R' and c.table_name = 要查询的表

查询外键约束的列名:

select * from user_cons_columns cl where cl.constraint_name = 外键名称

查询引用表的键的列名:

select * from user_cons_columns cl where cl.constraint_name = 外键引用表的键名

select t.*,c.COMMENTS from user_tab_columns t,user_col_comments c where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 要查询的表

select table_name,num_rows from user_tables;

select * from all_users;

select * from dba_users

①.0、Oracle查看当前用户连接:select * from v$Session

①.1、Oracle查看当前用户权限:select * from session_privs

select a.file_id "FileNo",a.tablespace_name

"Tablespace_name",

a.bytes "Bytes",a.bytes-sum(nvl(b.bytes,0)) "Used",

sum(nvl(b.bytes,0)) "Free",

sum(nvl(b.bytes,0))/a.bytes*100 "%free"

from dba_data_files a, dba_free_space b

where a.file_id=b.file_id(+)

group by a.tablespace_name ,

a.file_id,a.bytes order by a.tablespace_name;

以上就是土嘎嘎小编为大家整理的oracle怎么查表引用相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章