oracle中常用的数据字典浅析
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 oracle中常用的数据字典浅析 数据字典的简单分类: 按照前缀来说,数据字典分别为USER,ALL和DBA.其中,USER_*是关于用户所拥有的对象信息;ALL_*是有关用户可以访问的对象信息;DBA_*是有关整个数据库
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入
oracle中常用的数据字典浅析
数据字典的简单分类:
按照前缀来说,数据字典分别为USER,ALL和DBA.其中,USER_*是关于用户所拥有的对象信息;ALL_*是有关用户可以访问的对象信息;DBA_*是有关整个数据库对象的信息。
按照范围大小来说:DBA_*包含ALL_*包含USER_*
它们的区别,我们可以使用desc user_objects,desc all_objects,desc dba_objects来比较。
1.与数据表有关的:
(1)user_tables视图:select table_name from user_tables;//查询当前用户下有多少表
(2)user_catalog视图:select table_name from user_catalog;//该视图比user_tables视图简单
2.与数据库有关的:
(1)v$database视图: select name,created,log_mode,open_mode from v$database;查询数据库的库名,创建时间,归档状态,数据库的读写状态
(2)v$instance视图:SQL> select host_name,instance_name,version from v$instance;查询系统的主机名,实例名,和数据库版本
(3)v$version视图: select * from v$version;查询数据库版本的详细信息
3.与控制文件有关的
(1)v$controlefile:select name from v$controlfile;查询控制文件的路径
4.与日志有关
(1)v$log:select group#,members,bytes,status,archived from v$log;查询重做日志的组号,成员个数,文件大小,状态,是否归档
(2)v$logfile:select group#,status,type,member from v$logfile;查询日志文件的组号,状态,类型,文件类型
5.与表空间有关的
(1)dba_tablespaces:select tablespace_name,block_size,status,contents,logging from dba_tablespaces;查询数据库所有表空间的空间名,块大小,状态,类型,是否写入日志。
(2)dba_data_files:select tablespace_name,status,bytes,file_name from dba_data_files;查询表空间的名称,状态,大小和文件名
(3)database_properties: select * from database_properties where property_name like 'DEFAULT%';查询数据库默认临时表空间,默认永久表空间。
(4)v$datafile:select name,status from v$datafile where name like '%jinlian%';查看数据文件的状态(是否在线)
6.与用户有关的
(1)dba_users: select username from dba_users;查询数据库中有多少用户
(2)tab:select tname,tabtype from tab;查询当前用户下的对象和对象类型。
7.v$parameter视图:
这个视图一般用于查询一些文件的路径。例如:
select value from v$parameter where name='control_files';
8.与锁有关的视图:
v$lock:select sid,type from v$lock where block=1;查询当前正在阻塞的锁的事务的sid以及锁类型.
9.与undo 段有关的
(1)show parameter undo:显示undo信息
(2)dba_segments:select segment_name,tablespace_name,bytes from dba_segments
where segment_type='ROLLBACK'
查询段类型为ROLLBACK的段名,表空间名,字节大小
(3)select segment_name,tablespace_name,bytes from dba_segments
where segment_type='TYPE2 UNDO'
查询回滚表空间中回滚段的信息
(4)v$rollname: select usn,name from v$rollname;查询所有的回滚段名及序号
(5)v$rollstat:select a.usn,a.name,b.extents,b.status from v$rollname a,v$rollstat b where a.usn=b.usn
查询回滚段的详细信息
(6)dba_undo_extents:select tablespace_name,status,sum(bytes)/1024/1024 from dba_undo_extents
group by tablespace_name,status
查询undo表空间中过期数据和没有过期数据的信息。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



To query the Oracle tablespace size, follow the following steps: Determine the tablespace name by running the query: SELECT tablespace_name FROM dba_tablespaces; Query the tablespace size by running the query: SELECT sum(bytes) AS total_size, sum(bytes_free) AS available_space, sum(bytes) - sum(bytes_free) AS used_space FROM dba_data_files WHERE tablespace_

There are three ways to view instance names in Oracle: use the "sqlplus" and "select instance_name from v$instance;" commands on the command line. Use the "show instance_name;" command in SQL*Plus. Check environment variables (ORACLE_SID on Linux) through the operating system's Task Manager, Oracle Enterprise Manager, or through the operating system.

Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

Uninstall method for Oracle installation failure: Close Oracle service, delete Oracle program files and registry keys, uninstall Oracle environment variables, and restart the computer. If the uninstall fails, you can uninstall manually using the Oracle Universal Uninstall Tool.

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

To create a user in Oracle, follow these steps: Create a new user using the CREATE USER statement. Grant the necessary permissions using the GRANT statement. Optional: Use the RESOURCE statement to set the quota. Configure other options such as default roles and temporary tablespaces.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

Oracle Invalid numeric errors may be caused by data type mismatch, numeric overflow, data conversion errors, or data corruption. Troubleshooting steps include checking data types, detecting digital overflows, checking data conversions, checking data corruption, and exploring other possible solutions such as configuring the NLS_NUMERIC_CHARACTERS parameter and enabling data verification logging.
