Đang chuẩn bị liên kết để tải về tài liệu:
OCA: Oracle Database 11g Administrator Certified Associate- P7

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'oca: oracle database 11g administrator certified associate- p7', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Subqueries 231 If the scalar subquery returns more than one row the query will fail. If the scalar subquery returns no rows the value is NULL. Finding Total Space and Free Space Using Dictionary Views The following dictionary views are best friends of a DBA. They show the most critical aspect of the database from the user perspective the space allocated and free. If the DBA is not monitoring the growth and free space available in the database it is likely that they might get calls from the user community that they ran out of space in the tablespace. Let s build a query using four dictionary views you may need the SELECT_CATALOG_ROLE privilege to query these views . DBA_TABLESPACES Shows the tablespace name type and so on. DBA_DATA_FILES Shows the data files associated with a permanent or undo tablespace and the size of the data file. The total size of all data files associated with a tablespace gives the total size of the tablespace. DBA_TEMP_FILES Shows the temporary files associated with a temporary tablespace and their size. DBA_FREE_SPACE Shows the unallocated space free space in each tablespace. The query to get the tablespace names and type of tablespace would be as follows column tablespace_name format a18 SELECT tablespace_name contents FROM dba_tablespaces TABLESPACE_NAME CONTENTS SYSTEM PERMANENT SYSAUX PERMANENT UNDOTBS1 UNDO TEMP TEMPORARY USERS PERMANENT EXAMPLE PERMANENT To find the total space allocated to each tablespace you need to query DBA_DATA_FILES and DBA_TEMP_FILES. Since you are using a group function SUM along with a nonaggregated column tablespace_name the GROUP BY clause is a must. Notice the use of an arithmetic operation on the aggregated result to display the bytes in megabytes. SELECT tablespace_name SUM bytes 1048576 MBytes FROM dba_data_files 232 Chapter 4 Using Joins and Subqueries GROUP BY tablespace_name TABLESPACE_NAME MBYTES N B SYSAUX USERS SYSTEM EXAMPLE 730 800.1875 201.75 710 100 SELECT tablespace_name SUM bytes 1048576 .

TÀI LIỆU LIÊN QUAN