Oracle® Database Administrator's Guide 11g Release 2 (11.2) Part Number E10595-06 |
|
|
View PDF |
You can create datafiles and associate them with a tablespace using any of the statements listed in the following table. In all cases, you can either specify the file specifications for the datafiles being created, or you can use the Oracle-managed files feature to create files that are created and managed by the database server. The table includes a brief description of the statement, as used to create datafiles, and references the section of this book where use of the statement is specifically described:
SQL Statement | Description | Additional Information |
---|---|---|
CREATE TABLESPACE |
Creates a tablespace and the datafiles that comprise it | "Creating Tablespaces" |
CREATE TEMPORARY TABLESPACE |
Creates a locally-managed temporary tablespace and the tempfiles (tempfiles are a special kind of datafile) that comprise it | "Creating a Locally Managed Temporary Tablespace" |
ALTER TABLESPACE ... ADD DATAFILE |
Creates and adds a datafile to a tablespace | "Altering a Locally Managed Temporary Tablespace" |
ALTER TABLESPACE ... ADD TEMPFILE |
Creates and adds a tempfile to a temporary tablespace | "Creating a Locally Managed Temporary Tablespace" |
CREATE DATABASE |
Creates a database and associated datafiles | "Creating a Database with the CREATE DATABASE Statement" |
ALTER DATABASE ... CREATE DATAFILE |
Creates a new empty datafile in place of an old one--useful to re-create a datafile that was lost with no backup. | See Oracle Database Backup and Recovery User's Guide. |
If you add new datafiles to a tablespace and do not fully specify the filenames, the database creates the datafiles in the default database directory or the current directory, depending upon your operating system. Oracle recommends you always specify a fully qualified name for a datafile. Unless you want to reuse existing files, make sure the new filenames do not conflict with other files. Old files that have been previously dropped will be overwritten.
If a statement that creates a datafile fails, the database removes any created operating system files. However, because of the large number of potential errors that can occur with file systems and storage subsystems, there can be situations where you must manually remove the files using operating system commands.