本地管理表空间【转piner】
一、概述1、理解本地管理表空间的由来2、理解什么是字典管理表空间及工作原理3、理解本地管理表空间的优势(为什么要使用本地管理表空间)4、理解本地管理表空间的内部结构5、理解字典管理表空间与本地管理表空间的转换[@more@]二、名词解释与约定表空间(Tablespace)——为数据库提供使用空间的逻辑结构,其对应物理结构是数据文件,一个表空间可以包含多个数据文件。本地管理表空间(Locally Managed Tablespace简称LMT)——8i以后出现的一种新的表空间的管理模式,通过本地位图来管理表空间的空间使用。字典管理表空间(Dictionary-M
1Z0-031.8 - 3. 管理表空间(特殊表空间)
Undo Tablespace:--- 用于存储undo segments,不能包括任何其他的objects--- 本地管理方式--- 在创建的时候只能使用DATAFILE和EXTENT MANAGEMENT子句(受本地管理的制约等)CREATE UNDO TABLESPACE undo1 DATAFILE ‘/u01/oradata/undo101.dbf’ SIZE 40M.[@more@]Temporary Tablespace:--- 用于排序操作等临时工作--- 不能包含任何持久的objects--- 建议使用本地管理方式--- 总是NOLOGGING模式--- 可以使tempfile read-only--- 介质恢复(Media recovery)不包括恢复tempfiles--- BACKUP CONTROLFILE doesnot generate any information f
1Z0-031.8 - 2. 管理表空间(表空间的动作)
创建表空间:有关创建表空间看下面的语法,下面列出创建不同表空间的SQL语句:SQL语句表类型CREATE TABLESPACE创建(永久)表空间CREATE BIGFILE TABLESPACE创建大文件表空间CREATE TEMPORAY TABLESPACE创建临时表空间CREATE UNDO TABLESPACE创建撤销表空间[@more@]说明:DATAFILE:指明数据文件的子句LOGGING:说明在默认情况下,在此表空间中建的所有对象,包括表,索引等都会产生redo logging,LOGGING is the default. NOLOGGING:与LOGGING刚好相反。NOLOGGING affects only some DML and DDL commands,for example, direct loads.OFF
1Z0-031.8 - 1. 管理表空间(表空间的属性)
一些注意点概述:--- 一个tablespace可以有0或者多个segments--- 一个segment可以有1或者多个extent--- 除了SYSTEM表空间和包含获得undo段(an active undo segment)的表空间以外,表空间可以被tablen offline,而数据库仍照常运行--- 在数据库运行时,可以把表空间brought online--- 一个segment可以跨越属于同一个表空间的多个数据文件,但是不能跨越多个表空间--- 一个extent不能跨越多个数据文件[@more@]系统表空间(SYSTEM)与非系统表空间(NON-SYSTEM):--- 在创建数据库的时候创建--- 包含数据字典--- 包含SYSTEM undo segment-
1Z0-031.7 - 2. 重做日志文件的相关操作(日志组和日志成员的增加与删除,日志成员的重命名,clear日志组,移到日志组)
共同说明:[] : 表示是可选的| : 表示或者1.ADD LOG GROUP: 只增加一个日志成员的写法,用此种方法以后一定要再至少创建一个日志成员:ALTER DATABASE [database] ADD LOGFILE GROUP integer filespec SIZE size [REUSE] [,GROUP integer filespec SIZE size [REUSE] ...] ; 同时增加多个日志成员的写法(注意多了个小括号):ALTER DATABASE [database] ADD LOGFILE GROUP integer ( filespec , filespec , filespec ...] ) SIZE size [REUSE]; 说明:--- filespec : alter databa
1Z0-031.7 - 1. 管理重做日志文件
重做日志文件的结构体系:--- Redo Log Files以组的形式组织在一起--- 每个数据库至少要有2个组--- 每个组至少要有2个成员,每个成员的大小和内容都完全相同,冗余保证安全--- 在某个时间点上,只有一个组处于online状态(即数据库现在使用的是这个组)--- LGWR向当前online组的所有成员同时写入相同的redo log信息[@more@]相关参数:--- DB_CREATE_ONLINE_LOG_DEST_n:指定log file的存储目录--- LOG_ARCHIVE_DEST_n:指定归档日志的存储目录--- MAXLOGFILES:指定最多的日志组数目,在create database时用到,其最大值和默认值取决于OS-
1Z0-031.6. 管理控制文件.doc
Control File:--- binary file--- read at MOUNT stage--- should be multiplexed and recovery--- backup after database structure changes--- 在初始化参数中,CONTROL_FILE用于指定控制文件名。[@more@]Sizing:The size of control file is influenced by the following keywords in the CREATE DATABASE or CREATE CONTROLFILE commands:i>. MAXLOGFILESii>. MAXLOGMEMBERSiii>. MAXLOGHISTORYiv>. MAXDATAFILESv>. MAXINSTANCESContents:1. Database name and identifier (DB_NAME)2. Time stamp of database creati
SGA的区域信息
SGA(system global area)系统全局区跟一些必须的后台进程合进来称为实例(Instance).说它是全局区是包含了全局变量和数据结构,是系统区,是包含了进入整个Oracle Instance的数据结构而不是特定的进程结构。SGA区域:SGA大概包括下面四到五种区域:The fixed areaThe variable areaThe database blocks areaThe log bufferThe instance lock database(for parallel server instances)----OPS&RAC根据内存的大小,我们可以把The fixed area和The log buffer设为很小。[@more@]The fixed area:SGA中的The fixed area包含了数千个原子变量,以及
1Z0-031.5. 数据字典的内容与用法
Types:1. Data dictionary tables ---> reflect the database's information; describes the database and its objects2. Dynamic performance tables ---> reflect the instance's information[@more@] Data Dictionary Tables Contents: --- Logical and physical database structure --- Definitions and space allocations of objects --- Integrity constraints --- Users --- Roles --- Privileges --- Auditing All of them shows that it describes the Oracle Database not instanceTypes
1Z0-031.4. 手工新建数据库create database.doc
一直就想把这篇文章加进来,只可以一直没有时间。刚好今天给我在测试机器上来了个误操作rm * backup/*,把正在运行的数据库中的数据文件全部删除了,真是郁闷!还好这个是给我们新人们测试玩的,要不然就死定了!在此也做一个提醒,身为DBA,要永远记住甚用或者禁止使用rm命令,万不得以的情况下,使用时在敲enter也要看了又看、慎重又慎重才行!好了,费话不说了,下面请看我的过程。[@more@]Red Hat Enterprise 3 + Oracle 10g Release 2$su – oracle1--- 设置系统环境变量:ORACLE_HOME=/opt/oracle/product/10.2ORACLE_BASE=/opt/oracl
1Z0-031.3 - 5. 诊断文件(alert files, backgroud trace files, user trace files)
Diagnostic files are a means to capture information about the database's activities.-- alertSID.log file : Information for day-to-day operation of the database-- User trace files : Vital information for fatal user errors or user forced traced files.Alert Log File-- Each entry has a time stamp associated with it.-- Its location is defined by BACKGROUND_DUMP_DEST.-- When the database was started or shut down-- The startup of background processes-- The log sequence number LGWR is writing to-- Creat
1Z0-031.3 - 4. Oracle Managed Files(OMF)
What are Oracle-Managed Files? 使用Oracle管理的文件,简化了管理一个Oracle数据库,OMF不再需要你,DBA,直接管理作业系统的档案,包括一个Oracle数据库。你通过指定数据库对象,Oracle内部使用标准文件系统接口来创建和删除下列数据库的结构的文档:1 -- Tablespaces 2 -- Online redo log files3 -- Control files[@more@]Through initialization parameters, you specify the file system directory to be used for a particular type of file.(通过初始化参数,你指定的文件系统目录用来为某一类型的文件。) Oracle then ensures tha
1Z0-031.3 - 3. Startup and Shutdown Database
Startup Database:Syntax:STARTUP [FORCE] [RESTRICT] [PFILE=filename] [OPEN [RECOVER][database] | MOUNT | NOMOUNT][@more@]where:--- OPEN : enables users to access the database--- MOUNT : mounts the database for certain DBA activities but does not provide user access to the database--- NOMOUNT: creates the SGA and starts up the background processes but does not provide access to the database--- PFILE=parfile : enables a nondefault parameter file to be used to configure the instance--- FORCE
1Z0-031.3 - 2. 修改SPFILE的ALTER SYSTEM命令
设置SPFILE中的参数值(ALTER_SYSTEM_SET_CLAUSE):命令格式:ALTER SYSTEM SET parameter = value <COMMENT = ’text’> <DEFERRED> <SCOPE = MEMORY | SPFILE | BOTH> <SID = ’sid | *’> ;[@more@]分析格式:papameter = value : 这个赋值提供了参数名以及参数的新值。例如,pga_aggregate_target=1024m会把PGA_AGGREGATE_TARGET参数值设置为1024MB。comment = ‘text’ : 是一个与此参数设置相关的可选注释。这个注释会出现在V$PARAMETER视图的UPDATE_COMMENT字段中。如果使用了相应选项运行同时保存对SPFI
1Z0-031.3 - 1. Parameters & Parameter files (PFILE & SPFILE)
--- : Having an entry in the fileImplicittypes of initialization parameter file:PFILE--- Persistent parameter file, ,commonly referred to as spfileSID.ora[@more@]--- A list of instance parameters--- Allocations for memory structures of the System Global Area (SGA)--- The names and locations of control filesPFILE : initSID.ora--- Modifications to the file are made manually.--- Its default location is $ORACLE_HOME/dbs.--- Specify the values in the following format: .optional--- Parameters can be s
1Z0-031.2 - 2. Database Administrator Users & User Login Authortication & DBA Tools
Database Administrator Users:- Two database user accounts, SYS and SYSTEM, are created automatically with the database and granted the DBA role.- The DBA role has all database system privileges.- SYS : Owner of the database data dictionary.- SYSTEM : Owner of additional internal tables and views used by Oracle tools[@more@]Authentication Methods for Database Administrators:- operating system authentication- password files to authenticate database administrators.Using Password File Authentication
1Z0-031.2 - 1.最佳灵活结构 Optimal Flexible Architecture (OFA)
Optimal Flexible Architecture (OFA):-> OFA organizes database files by type and usage[@more@]-> Involves three major rules- Establish a directory structure where any database file can be stored on any disk resourcea. Name all devices that might contain Oracle data in such a manner that a wild card or similar mechanism can be used to refer to the collection of devices as a unit. b. Make a directory explicitly for storage of Oracle data at the same level on each of these devices. c. Beneath
1Z0-031.1. 体系结构概述
[@more@]总体结构:- 软件结构- 存储结构存储结构:- 逻辑存储结构:主要描述Oracle数据库的内部存储结构,即在技术概念上描述在Oracle数据库中如何组织、管理数据- 物理存储结构:主要描述Oracle数据库的外部存储结构,即在操作系统中如何组织、管理数据逻辑存储结构:- 在技术概念上描述在Oracle数据库中如何组织、管理数据- 通过查询Oracle数据库的数据字典,可以找到逻辑存储结构的描述- 简单描述:多个数据块组成区,多个区组成段,多个段组成表空间,多个表空间组成逻辑数据库物理存储结构:- 现实的数据存储单元,对应于操作系统的
SQL:Group Functions,GROUP BY,HAVING
GROUP FUNCTIONS operate on sets of rows to give one result per group.Types:- AVG- COUNT- MAX- MIN- STDDEV:标准偏差- SUM- VARIANCE:方差[@more@]Syntax:SELECT [column,] group_function(column),..FROM table[WHERE condition][GROUP BY column][HAVING group_condion][ORDER BY column];1. You can use AVG and SUM for numeric data.2. You can use MIN and MAX for any data type.3. COUNT(*) returns the number of rows in a table.4. Using the DISTINCT Keyword: COUNT(DISTINCT expr) returns the number of distinct n
SQL: JOIN
Join Types:1. Inner Join - Equal-Join - Non-Equal-Join2. Outer Join - Left-Outer-Join - Right-Outer-Join3. Self Join - Join a table to itself - Using the table's alias name to complete the self join. - attention the repeat lines[@more@]-----------------------------------------------------------------------------------------------------------------Joining Tables Using Oracle Syntax:- Write the join condition in the WHERE clause.- Prefix the column name with the table name when the same co