Está en la página 1de 6

Responsibilities of Database Administrators

The principal responsibility of a database administrator (DBA) is to make enterprise data available to its users. DBAs must work closely with the developers to ensure that their applications make efficient use of the database, and with system administrators to ensure that physical resources are adequate and used efficiently. Oracle DBAs are responsible for understanding the Oracle Database architecture and how the database works. DBAs can expect to perform the following tasks:

Installing, upgrading, and patching Oracle Database software Designing databases, including identifying requirements, creating the logical design (conceptual model), and physical database design Creating Oracle databases Developing and testing a backup and recovery strategy, backing up Oracle databases regularly, and recovering them in case of failures Configuring the network environment to enable clients to connect to databases Starting up and shutting down the database Managing storage for the database Managing users and security Managing database objects such as tables, indexes, and views Monitoring and tuning database performance Investigating, gathering diagnostic data for, and reporting to Oracle Support Services any critical database errors Evaluating and testing new database features

Creating the Database


This section presents the steps involved when you create a database manually. These steps should be followed in the order presented. The prerequisites described in the preceding section must already have been completed. That is, you have established the environment for creating your Oracle Database, including most operating system dependent environmental variables, as part of the Oracle software installation process. Step 1: Decide on Your Instance Identifier (SID) Step 2: Establish the Database Administrator Authentication Method Step 3: Create the Initialization Parameter File Step 4: Connect to the Instance

Step 5: Create a Server Parameter File (Recommended) Step 6: Start the Instance Step 7: Issue the CREATE DATABASE Statement Step 8: Create Additional Tablespaces Step 9: Run Scripts to Build Data Dictionary Views Step 10: Run Scripts to Install Additional Options (Optional) Step 11: Back Up the Database.

Creating a Database: Example To create the new database, use the CREATE DATABASE statement. The following statement creates database mynewdb:

CREATE DATABASE mynewdb USER SYS IDENTIFIED BY pz6r58 USER SYSTEM IDENTIFIED BY y1tz5p LOGFILE GROUP 1 ('/u01/oracle/oradata/mynewdb/redo01.log') SIZE 100M, GROUP 2 ('/u01/oracle/oradata/mynewdb/redo02.log') SIZE 100M, GROUP 3 ('/u01/oracle/oradata/mynewdb/redo03.log') SIZE 100M MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 MAXINSTANCES 1 CHARACTER SET US7ASCII NATIONAL CHARACTER SET AL16UTF16 DATAFILE '/u01/oracle/oradata/mynewdb/system01.dbf' SIZE 325M REUSE EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/u01/oracle/oradata/mynewdb/sysaux01.dbf' SIZE 325M REUSE DEFAULT TABLESPACE tbs_1

DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/u01/oracle/oradata/mynewdb/temp01.dbf' SIZE 20M REUSE UNDO TABLESPACE undotbs DATAFILE '/u01/oracle/oradata/mynewdb/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

Managing Tablespaces and Datafiles


Semantics BIGFILE | SMALLFILE Use this clause to determine whether the tablespace is a bigfile or smallfile tablespace. This clause overrides any default tablespace type setting for the database. A bigfile tablespace contains only one datafile or tempfile, which can contain up to approximately 4 billion (232) blocks. The maximum size of the single datafile or tempfile is 128 terabytes (TB) for a tablespace with 32K blocks and 32TB for a tablespace with 8K blocks. A smallfile tablespace is a traditional Oracle tablespace, which can contain 1022 datafiles or tempfiles, each of which can contain up to approximately 4 million (222) blocks. If you omit this clause, then Oracle Database uses the current default tablespace type of permanent or temporary tablespace set for the database. If you specify BIGFILE for a permanent tablespace, then the database by default creates a locally managed tablespace with automatic segment-space management. Restrictions on Bigfile Tablespaces Bigfile tablespaces are subject to the following restrictions: You can specify only one datafile in the DATAFILE clause or one tempfile in the TEMPFILE clause.

You cannot specify EXTENT MANAGEMENT DICTIONARY.

DATAFILE | TEMPFILE Clause


Specify the datafiles to make up the permanent tablespace or the tempfiles to make up the temporary tablespace. Use the datafile_tempfile_spec form of file_ specification to create regular datafiles and tempfiles in an operating system file system or to create Automatic Storage Management disk group files. You must specify the DATAFILE or TEMPFILE clause unless you have enabled Oracle-managed files by setting a value for the DB_CREATE_FILE_DEST initialization parameter. For Automatic Storage Management diskgroup files, the parameter must be set to a multiple file creation form of Automatic Storage Management filenames. If this parameter is set, then the database creates a systemnamed 100 MB file in the default file destination specified in the parameter. The file has AUTOEXTEND enabled and an unlimited maximum size. Creating a Bigfile Tablespace: Example The following example creates a bigfile tablespace bigtbs_01 with a datafile bigtbs_f1.dat of 10 MB: CREATE BIGFILE TABLESPACE bigtbs_01 DATAFILE 'bigtbs_f1.dat' SIZE 20M AUTOEXTEND ON; Creating an Undo Tablespace: Example The following example creates a 10 MB undo tablespace undots1: CREATE UNDO TABLESPACE undots1 DATAFILE 'undotbs_1a.f' SIZE 10M AUTOEXTEND ON RETENTION GUARANTEE; Creating a Temporary Tablespace: Example This statement shows how the temporary tablespace that serves as the default temporary tablespace for database users in the sample database was created: CREATE TEMPORARY TABLESPACE temp_demo TEMPFILE 'temp01.dbf' SIZE 5M AUTOEXTEND ON; If we assume that the default database block size is 2K, and that each bit in the map represents one extent, then each bit maps 2,500 blocks.

The following example sets the default location for datafile creation and then creates a tablespace with an Oracle-managed tempfile in the default location. The tempfile is 100 M and is autoextensible with unlimited maximum size. These are the default values for Oracle-managed files: ALTER SYSTEM SET DB_CREATE_FILE_DEST = '$ORACLE_HOME/rdbms/dbs'; CREATE TEMPORARY TABLESPACE tbs_05;

Adding a Temporary Tablespace to a Tablespace Group: Example The following statement creates the tbs_temp_02 temporary tablespace as a member of the tbs_grp_01 tablespace group. If the tablespace group does not already exist, then Oracle Database creates it during execution of this statement: CREATE TEMPORARY TABLESPACE tbs_temp_02 TEMPFILE 'temp02.dbf' SIZE 5M AUTOEXTEND ON TABLESPACE GROUP tbs_grp_01;

Creating Basic Tablespaces: Examples This statement creates a tablespace named tbs_01 with one datafile: CREATE TABLESPACE tbs_01 DATAFILE 'tbs_f2.dat' SIZE 40M ONLINE; This statement creates tablespace tbs_03 with one datafile and allocates every extent as a multiple of 500K: CREATE TABLESPACE tbs_03 DATAFILE 'tbs_f03.dbf' SIZE 20M LOGGING;

RENAME Clause
Use this clause to rename tablespace. This clause is valid only if tablespace and all its datafiles are online and the COMPATIBLE parameter is set to 10.0.0 or greater. You can rename both permanent and temporary tablespaces. If tablespace is read only, then Oracle Database does not update the datafile headers to reflect the new name. The alert log will indicate that the datafile headers have not been updated. If tablespace has been designated as the undo tablespace for any instance in a Real Application Clusters environment, and if a server parameter file was used to start up the database, then Oracle Database changes the value of the UNDO_TABLESPACE

parameter for that instance in the server parameter file (SPFILE) to reflect the new tablespace name. If a single-instance database is using a parameter file (pfile) instead of an spfile, then the database puts a message in the alert log advising the database administrator to change the value manually in the pfile. Restriction on Renaming Tablespaces You cannot rename the SYSTEM or SYSAUX tablespaces.

DROP TABLESPACE
Purpose Use the DROP TABLESPACE statement to remove a tablespace from the database. When you drop a tablespace, Oracle Database does not place it in the recycle bin. Therefore, you cannot subsequently either purge or undrop the tablespace. Prerequisites You must have the DROP TABLESPACE system privilege. You cannot drop a tablespace if it contains any rollback segments holding active transactions.. CASCADE CONSTRAINTS Specify CASCADE CONSTRAINTS to drop all referential integrity constraints from tables outside tablespace that refer to primary and unique keys of tables inside tablespace. If you omit this clause and such referential integrity constraints exist, then Oracle Database returns an error and does not drop the tablespace. Examples Dropping a Tablespace: Example The following statement drops the tbs_01 tablespace and drops all referential integrity constraints that refer to primary and unique keys inside tbs_01: DROP TABLESPACE tbs_01 INCLUDING CONTENTS CASCADE CONSTRAINTS;

Deleting Operating System Files: Example The following example drops the tbs_02 tablespace and deletes all associated operating system datafiles: DROP TABLESPACE tbs_02 INCLUDING CONTENTS AND DATAFILES;

También podría gustarte