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











Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

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.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

Oracle views can be exported through the EXP utility: Log in to the Oracle database. Start the EXP utility, specifying the view name and export directory. Enter export parameters, including target mode, file format, and tablespace. Start exporting. Verify the export using the impdp utility.
