Documentos de Académico
Documentos de Profesional
Documentos de Cultura
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
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;
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;