What is different between TRUNCATE and DELETE?

The Delete command will log the data changes in the log file where as the truncate will simply remove the data without it. Hence Data removed by Delete command can be rolled back but not the data removed by TRUNCATE. Truncate is a DDL statement whereas DELETE is a DML statement What is the maximum buffer size that can be specified using the DBMS_OUTPUT.ENABLE function? 1000000 Can you use a commit statement within a database trigger? Yes, if you are using autonomous transactions in the Database triggers. What is an UTL_FILE? What are different procedures and functions associated with it? The UTL_FILE package lets your PL/SQL programs read and write operating system (OS) text files. It provides a restricted version of standard OS stream file input/output (I/O). Subprogram -Description FOPEN function-Opens a file for input or output with the default line size. IS_OPEN function -Determines if a file handle refers to an open file. FCLOSE procedure -Closes a file. FCLOSE_ALL procedure -Closes all open file handles. GET_LINE procedure -Reads a line of text from an open file. NEW_LINE procedure-Writes one or more OS-specific line terminators to a file. FFLUSH procedure-Physically writes all pending output to a file. FOPEN function -Opens a file with the maximum line size specified. What are between database triggers and form triggers? Database triggers are fired whenever any database action like INSERT, UPATE, DELETE, LOGON LOGOFF etc occurs. Form triggers on the other hand are fired in response to any event that takes place while working with the forms, say like navigating from one field to another or one block to another and so on. What is OCI. What are its uses? OCI is Oracle Call Interface. When applications developers demand the most powerful interface to the Oracle Database Server, they call upon the Oracle Call Interface (OCI). OCI provides the most comprehensive access to all of the Oracle Database functionality. The newest performance, scalability, and security features appear first in the OCI API. If you write applications for the Oracle Database, you likely already depend on OCI. Some types of applications that depend upon OCI are:

· PL/SQL applications executing SQL · C++ applications using OCCI · Java applications using the OCI-based JDBC driver · C applications using the ODBC driver · VB applications using the OLEDB driver · Pro*C applications · Distributed SQL What are ORACLE PRECOMPILERS? A precompiler is a tool that allows programmers to embed SQL statements in high-level source programs like C, C++, COBOL, etc. The precompiler accepts the source program as input, translates the embedded SQL statements into standard Oracle runtime library calls, and generates a modified source program that one can compile, link, and execute in the usual way. Examples are the Pro*C Precompiler for C, Pro*Cobol for Cobol, SQLJ for Java etc.

What is syntax for dropping a procedure and a function? Are these operations possible? Drop Procedure/Function ; yes, if they are standalone procedures or functions. If they are a part of a package then one have to remove it from the package definition and body and recompile the package. What Is Oracle? Oracle is a company. Oracle is also a database server, which manages data in a very structured way. It allows users to store and retrieve related data in a multiuser environment so that many users can concurrently access the same data. All this is accomplished while delivering high performance. A database server also prevents unauthorized access and provides efficient solutions for failure recovery. What Is an Oracle Database? An Oracle database is a collection of data treated as a big unit in the database server. What Is an Oracle Instance? Every running Oracle database is associated with an Oracle instance. When a database is started on a database server (regardless of the type of computer), Oracle allocates a memory area called the System Global Area (SGA) and starts one or more Oracle processes. This combination of the SGA and the Oracle processes is called an Oracle instance. The memory and processes of an instance manage the associated database's data efficiently and serve the one or multiple users of the database.

What Is a Parameter File? A parameter file is a file that contains a list of initialization parameters and a value for each parameter. You specify initialization parameters in a parameter file that reflect your particular installation. Oracle supports the following two types of parameter files:
y y

Server Parameter Files - Binary version. Persistent. Initialization Parameter Files - Text version. Not persistent.

What Is a Server Parameter File? A server parameter file is a binary file that acts as a repository for initialization parameters. The server parameter file can reside on the machine where the Oracle database server executes. Initialization parameters stored in a server parameter file are persistent, in that any changes made to the parameters while an instance is running can persist across instance shutdown and startup.

What Is a Initialization Parameter File? An initialization parameter file is a text file that contains a list of initialization parameters. The file should be written in the client's default character set. Sample initialization parameter files are provided on the Oracle distribution medium for each operating system. A sample file is sufficient for initial use, but you will probably want to modify the file to tune the database for best performance. Any changes will take effect after you completely shut down and restart the instance. What is System Global Area (SGA)?
The SGA is a chunk of memory that is allocated by an Oracle Instance (during the nomount stage) and is shared among Oracle processes, hence the

The SGA is allocated in memory when an Oracle database instance is started, and any change in the value will take effect at the next startup.
name. It contains all sorts of information about the instance and the database that is needed to operate.

What is PGA? When you start a user process, that process has a private RAM area, used for sorting SQL results and managing special joins called ³hash´ joins. This private RAM is known as the Program Global Area (PGA). Each individual PGA memory area is allocated each time a new user connects to the database.
The PGA (Program or Process Global Area) is a memory area (RAM) that stores data and control information for a single process.

What Is a User Account? A user account is defines the user's attributes AND identified by a user name, including the following

You give each column a column name. You create new roles. Each user owns a single schema. A schema is a logical container for the database objects (such as tables. and job_id. Privileges are assigned to users through user roles.y y y y Password for database authentication Privileges and roles Default tablespace for database objects Default temporary tablespace for query processing work space What Is the Relation of a User Account and a Schema? User accounts and schemas have a one-to-one relation. When you create a user. and a set of columns. as in DATE. such as employees. views. last_name. A schema is owned by a database user and has the same name as that user. triggers. and a width. define precision and scale instead of width. views. DATE. What Is a User Role? A user role is a group of privileges. Data is stored in rows and columns. you are also implicitly creating a schema for that user. You define a table with a table name. If columns are of the NUMBER datatype. What Is a Database Table? A database table is a basic unit of data logical storage in an Oracle database. . The schema name is the same as the user name. a datatype. or NUMBER. such as employee_id. and can be used to unambiguously refer to objects owned by the user. The width can be predetermined by the datatype. A row is a collection of column information corresponding to a single record. Schema objects can be created and manipulated with SQL and include: tables. and other types of data objects. grant privileges to the roles. and so on) that the user creates. What is a Database Schema? A schema is a collection of logical structures of data. What Is a Table Index? Index is an optional structure associated with a table that allow SQL statements to execute more quickly against a table. and then grant roles to users. or schema objects. such as VARCHAR2.

multiple application objects can be stored in one tablespace. including information from the current user's schema as well as information from objects in other schemas. A DBA_ view displays all relevant information in the entire database.You can select from these views. What Is a Static Data Dictionary? Data dictionary tables are not directly accessible. What Is an Oracle Data File? An Oracle data file is a big unit of physical storage in the OS file system.What Is an Oracle Tablespace? A tablespace is a logical storage unit . To list the data dictionary views available to you. query the view DICTIONARY. . Tables in recycle bin can be recovered back into database by the Flashback Drop action. What Is a Dynamic Performance View? Dynamic performance views. but you can access information in them through data dictionary views. A USER_ view displays all the information from the schema of the current user. or "V$" views. and their contents relate primarily to performance. DBA_ views are intended only for administrators. are useful for identifying instance-level performance problems. Each tablespace in an Oracle database consists of one or more files called datafiles. in case it was dropped in error. This privilege is assigned to the DBA role when the system is initially installed. One or many Oracle data files are organized together to provide physical storage to a single Oracle tablespace. They can be accessed only by users with the SELECT ANY TABLE privilege. All V$ views are listed in the V$FIXED_TABLE view. Oracle database recycle save the same purpose as the recycle bin on your Windows desktop. What Is a Recycle Bin? Recycle bin is a logical storage to hold the tables that have been dropped from the database. No special privileges are required to query these views. if the current user has access to those objects by way of grants of privileges or roles. A database can contain multiple tablespaces. These views are called dynamic performance views because they are continuously updated while a database is open and in use. Many data dictionary tables have three corresponding views: y y y An ALL_ view displays all the information accessible to the current user. but you can never update or alter them.

a Windows Graphical User Interface (GUI) and the iSQL*Plus web-based user interface. built into the Oracle Net foundation layer that works with any standard network transport protocol. What Is Open Database Communication (ODBC)? ODBC. . How a Database Is Related to Tablespaces? A database's data is collectively stored in the datafiles that constitute each tablespace of the database. One or many Oracle data files are organized together to provide physical storage to a single Oracle tablespace.Recycle bin can be turned on or off in the recyclebin=on/off in your parametere file. Transport Network Substrate. the simplest Oracle database would have one tablespace and one datafile. Open Database Communication. which are physical structures that conform to the operating system in which Oracle is running. How a Tablespace Is Related to Data Files? Each tablespace in an Oracle database consists of one or more files called datafiles. a standard API (application program interface) developed by Microsoft for Windows applications to communicate with database management systems. Oracle offers ODBC drivers to allow Windows applications to connect Oracle server through ODBC. It has a command-line user interface. For example. What Is Transport Network Substrate (TNS)? TNS. What Is SQL*Plus? SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database Server or Client installation. each consisting of two datafiles (for a total of six datafiles). like tables and indexes. What Is an Oracle Data File? An Oracle data file is a big unit of physical storage in the OS file system. Another database can have three tablespaces. TABLESPACE AND DATAFILE What Is an Oracle Tablespace? An Oracle tablespace is a big unit of logical storage in an Oracle database. is a foundation technology. It is managed and used by the Oracle server to store structures data objects.

each Oracle instance is assigned one (and only one) undo tablespace. Some database components that formerly created and used separate tablespaces now occupy the SYSAUX tablespace. SQL> SELECT TABLESPACE_NAME. TABLESPACE_NAME STATUS CONTENTS -----------------------------.--------. you can use the DBA_TABLESPACES view as shown in the following SQL script example: SQL> connect SYSTEM/fyicenter Connected. A locally managed SYSTEM tablespace cannot be used for default temporary storage. SQL> SELECT TABLESPACE_NAME. SYSAUX Tablespace . In automatic undo management mode. BYTES . The SYSTEM tablespace is always online when the database is open. UNDO Tablespace . CONTENTS 2 FROM USER_TABLESPACES.The SYSAUX tablespace was installed as an auxiliary tablespace to the SYSTEM tablespace when you created your database. Oracle server will create 4 required tablespaces for the new database: y y y y SYSTEM Tablespace . SQL> col file_name format a36. SQL> col tablespace_name format a16. TEMP Tablespace . which Oracle creates automatically when the database is created.When the SYSTEM tablespace is locally managed. you can use the DBA_TABLESPACES view as shown in the following SQL script example: SQL> connect SYSTEM/fyicenter Connected.How To View the Tablespaces in the Current Database? If you want to get a list of all tablespaces used in the current database instance. You cannot create any other segment types (for example. tables or indexes) in undo tablespaces.Every Oracle database contains a tablespace named SYSTEM. STATUS. How To View the Data Files in the Current Database? If you want to get a list of all tablespaces used in the current database instance. FILE_NAME. you must define at least one default temporary tablespace when creating a database.--------SYSTEM ONLINE PERMANENT UNDO ONLINE UNDO SYSAUX ONLINE PERMANENT TEMP ONLINE TEMPORARY USERS ONLINE PERMANENT What Are the Predefined Tablespaces in a Database? When you create a new database. Each database contains zero or more undo tablespaces. Undo data is managed within an undo tablespace using undo segments that are automatically created and maintained by Oracle.UNDO tablespaces are special tablespaces used solely for storing undo information.

2 FROM DBA_DATA_FILES..DBF BYTES --------104857600 461373440 94371840 356515840 How To Create a new Oracle Data File? There is no dedicated statement to create a data file. CONTENTS 2 FROM USER_TABLESPACES.-------------------------------USERS \ORACLEXE\ORADATA\XE\USERS.DBF SYSAUX \ORACLEXE\ORADATA\XE\SYSAUX.DBF SYSTEM \ORACLEXE\ORADATA\XE\SYSTEM. How To Rename a Tablespace? You can easily rename a tablespace by using the ALTER TABLESPACE ..DBF MY_SPACE \TEMP\MY_SPACE. TABLESPACE_NAME FILE_NAME --------------. you will see the data file is located in the \temp directory of..DBF SYSTEM \ORACLEXE\ORADATA\XE\SYSTEM. DATAFILE statement as shown in the following script: SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. RENAME TO statement as shown in the example below: .--------------.DBF SYSAUX \ORACLEXE\ORADATA\XE\SYSAUX.DBF UNDO \ORACLEXE\ORADATA\XE\UNDO. BYTES 2 FROM DBA_DATA_FILES.. you can use the CREATE TABLESPACE . SQL> SELECT TABLESPACE_NAME. Data files are created as part of statements that manages other data structures. If you check your file system with Windows file explorer.--------SYSTEM ONLINE PERMANENT UNDO ONLINE UNDO SYSAUX ONLINE PERMANENT TEMP ONLINE TEMPORARY USERS ONLINE PERMANENT MY_SPACE ONLINE PERMANENT SQL> SELECT TABLESPACE_NAME. Its contents should be blank and full of \x00 at this time. STATUS.DBF UNDO \ORACLEXE\ORADATA\XE\UNDO. How To Create a New Tablespace? If you want a new dataspace. TABLESPACE_NAME STATUS CONTENTS ---------------. TABLESPACE_NAME FILE_NAME --------------.DBF BYTES --------104857600 461373440 94371840 356515840 10485760 So one statement created two structures: a tablespace and a data file.dbf' SIZE 10M. The data file size is about 10MB. like tablespace and database. FILE_NAME. Tablespace created.------------------------------USERS \ORACLEXE\ORADATA\XE\USERS.

You can delete a tablespace by using the DROP TABLESPACE statement as shown in the example below: SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space.--------------. what happens to its data files? By default. SQL> DROP TABLESPACE my_space. CONTENTS 2 FROM USER_TABLESPACES. Of course.dbf' SIZE 10M. data files will remain in OS file system. Tablespace created. SQL> SELECT TABLESPACE_NAME. SQL> ALTER TABLESPACE my_space RENAME TO your_space. SQL> DROP TABLESPACE my_space INCLUDING CONTENTS 2 AND DATAFILES. TABLESPACE_NAME STATUS CONTENTS ---------------. What Happens to the Data Files If a Tablespace Is Dropped? If a tablespace is dropped. Another way of deleting data files is to use the INCLUDING clause in the DROP TABLESPACE statement.--------SYSTEM ONLINE PERMANENT UNDO ONLINE UNDO SYSAUX ONLINE PERMANENT TEMP ONLINE TEMPORARY USERS ONLINE PERMANENT YOUR_SPACE ONLINE PERMANENT How To Drop a Tablespace? If you have an existing tablespace and you don't want it anymore. Tablespace dropped.dbf' SIZE 10M. STATUS. if they are no longer needed. Tablespace dropped.dbf' SIZE 10M. Tablespace created. How To Create a Table in a Specific Tablespace? . Tablespace created.SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. Here is a SQL sample script: SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. you delete the data files using OS commands. Tablespace created. even if the tablespace they are mapped is dropped.

of free space in a data file of a tablespace.. you can give it to your users for them to create tables in the new tablespace. 'MY_SPACE'). tablespace_name.---------.dbf' SIZE 10M. BYTES 2 FROM USER_FREE_SPACE 3 WHERE TABLESPAE_NAME IN ('USERS'. SQL> CREATE TABLE my_team TABLESPACE my_space 2 AS SELECT * FROM employees. num_rows 2 FROM USER_TABLES 3 WHERE tablespace_name in ('USERS'. Here is SQL script example on how to see free space of a tablespace: SQL> connect HR/fyicenter Connected. Tablespace created.---------MY_SPACE 5 10354688 USERS 4 101974016 USERS 4 65536 USERS 4 65536 USERS 4 65536 USERS 4 65536 USERS 4 65536 . Each record in USER_FREE_SPACE represents an extent..---------MY_SPACE USERS 107 How To See Free Space of Each Tablespace? One of the important DBA tasks is to watch the storage usage of all the tablespaces to make sure there are enough free space in each tablespace for database applications to function properly. TABLE_NAME -----------------------------MY_TEAM EMPLOYEES . FILE_ID. SQL> connect HR/fyicenter Connected. Table created. SQL> SELECT TABLESPACE_NAME. a contiguous area of space. you need to use the TABLESPACE clause in the CREATE TABLE statement. SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. TABLESPACE_NAME FILE_ID BYTES -----------------------------. SQL> SELECT table_name. Here is a sample script: SQL> connect SYSTEM/fyicenter Connected. TABLESPACE_NAME NUM_ROWS ---------------.After you have created a new tablespace. Free space information can be monitored through the USER_FREE_SPACE view. To create a table in a specific tablespace. 'MY_SPACE').

SQL> ALTER TABLESPACE my_space OFFLINE NORMAL. Tablespace altered. you can use the ALTER TABLESPACE . SQL> ALTER TABLESPACE my_space OFFLINE NORMAL. Tablespace created... USERS has one big free extent of 100MB. ONLINE statement as shown in the following script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space.dbf' SIZE 10M. Tablespace altered. How To Bring a Tablespace Online? If you have brought a tablespace offline. now you want to make it available to users again. SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space.USERS USERS USERS USERS USERS USERS USERS 4 4 4 4 4 4 4 65536 65536 65536 65536 65536 65536 65536 This tells us that: y y MY_SPACE has a single free extent of 10MB.. Tablespace altered.. OFFLINE statement as shown in the following script: SQL> connect HR/fyicenter Connected. .dbf' SIZE 10M.. How To Add Another Datafile to a Tablespace? . you can bring it offline using the ALTER TABLESPACE .. SQL> ALTER TABLESPACE my_space ONLINE. How To Bring a Tablespace Offline? If you want to stop users using a tablespace. and many small free extents of 64KB. Tablespace created.

DBF SYSTEM C:\ORACLEXE\ORADATA\XE\SYSTEM.DBF UNDO C:\ORACLEXE\ORADATA\XE\UNDO.. now 80% of the data file is used. TABLESPACE_NAME FILE_NAME --------------. you accidently deleted a data file from the operating system.---------MY_SPACE 6 5177344 MY_SPACE 5 10354688 This script created one tablespace with two data files. SQL> ALTER TABLESPACE my_space 2 DATAFILE '/temp/my_space_2.--------------------------------USERS C:\ORACLEXE\ORADATA\XE\USERS. What Happens If You Lost a Data File? After you shuting down an Oracle database. FILE_NAME.If you created a tablespace with a data file a month ago.DBF BYTES --------104857600 461373440 94371840 356515840 10485760 5242880 SQL> SELECT TABLESPACE_NAME..DBF SYSAUX C:\ORACLEXE\ORADATA\XE\SYSAUX. BYTES 2 FROM USER_FREE_SPACE 3 WHERE TABLESPAE_NAME IN ('MY_SPACE'). If you try to start the database again you will get error when Oracle tries to open the database after mounting the database. This can be done by using the ALTER TABLESPACE .dbf' SIZE 5M. SQL> SELECT TABLESPACE_NAME. BYTES 2 FROM DBA_DATA_FILES. Tablespace created. you should add another data file to the tablespace.DBF MY_SPACE C:\TEMP\MY_SPACE_2. FILE_ID.dbf is deleted.dbf' SIZE 10M. But it will fail on openning the database as shown below in a SQL*Plus session: >sqlplus /nolog SQL> connect SYSTEM/fyicenter AS SYSDBA SQL> STARTUP ORACLE instance started. The following tutorial examples shows you what will happen if the data file c:\temp\my_space.DBF MY_SPACE C:\TEMP\MY_SPACE. ADD DATAFILE statement. TABLESPACE_NAME FILE_ID BYTES -----------------------------. Total System Global Area Fixed Size 100663296 bytes 1285956 bytes . Tablespace altered. Oracle can still start the database instance and mount the database.---------. See the following sample script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space.

ORA-01109: database not open Database dismounted. Database altered.see DBWR trace file ORA-01110: data file 5: 'C:\TEMP\MY_SPACE. ORACLE instance shut down. col tablespace_name format a16.DBF 503316480 C:\ORACLEXE\ORADATA\XE\UNDO. FILE_NAME.DBF 94371840 TABLESPACE_NAME --------------USERS SYSAUX UNDO . ORA-01157: cannot identify/lock data file 5 . SQL> SQL> SQL> 2 col file_name format a36. FILE_NAME BYTES --------------------------------. BYTES FROM DBA_DATA_FILES. 100663296 1285956 58720444 37748736 2908160 bytes bytes bytes bytes bytes SQL> ALTER DATABASE DATAFILE '\temp\my_space. What you can do is to set the bad data file as offline befor opening the database.--------C:\ORACLEXE\ORADATA\XE\USERS. How Remove Data Files befor opening a Database? Let's say you have a corrupted data file or lost a data file.DBF' SQL> SHUTDOWN. ORACLE instance started. SQL> ALTER DATABASE DATAFILE '\temp\my_space_2.DBF 104857600 C:\ORACLEXE\ORADATA\XE\SYSAUX. The tutorial exercise shows you how to set two data files offline and open the database without them: >sqlplus /nolog SQL> connect SYSTEM/fyicenter AS SYSDBA SQL> STARTUP MOUNT.dbf' 2 OFFLINE DROP. Database altered. But it will not open the database.dbf' 2 OFFLINE DROP.Variable Size 58720444 bytes Database Buffers 37748736 bytes Redo Buffers 2908160 bytes Database mounted. Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers Database mounted. Database altered. Oracle can mount the database. SELECT TABLESPACE_NAME. SQL> ALTER DATABASE OPEN.

DBF 367001600 C:\TEMP\MY_SPACE. FILE_ID.DBF C:\TEMP\MY_SPACE_2. Tablespace created.dbf' SIZE 5M. Tablespace created.dbf' SIZE 10M.. now 80% of the data file is used. See the following sample script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. FILE_NAME..SYSTEM MY_SPACE MY_SPACE C:\ORACLEXE\ORADATA\XE\SYSTEM.DBF SQL> SELECT TABLESPACE_NAME. Tablespace altered. SQL> ALTER TABLESPACE my_space 2 DATAFILE '/temp/my_space_2..DBF MY_SPACE C:\TEMP\MY_SPACE_2. Tablespace altered.dbf' SIZE 10M. How To Add Another Datafile to a Tablespace? If you created a tablespace with a data file a month ago.DBF SYSTEM C:\ORACLEXE\ORADATA\XE\SYSTEM.. TABLESPACE_NAME FILE_NAME --------------. SQL> ALTER TABLESPACE my_space ONLINE.DBF How To Bring a Tablespace Online? If you have brought a tablespace offline.. Tablespace altered..--------------------------------USERS C:\ORACLEXE\ORADATA\XE\USERS. now you want to make it available to users again. you should add another data file to the tablespace. ADD DATAFILE statement. BYTES 2 FROM DBA_DATA_FILES. you can use the ALTER TABLESPACE . SQL> SELECT TABLESPACE_NAME.DBF MY_SPACE C:\TEMP\MY_SPACE.DBF SYSAUX C:\ORACLEXE\ORADATA\XE\SYSAUX.DBF UNDO C:\ORACLEXE\ORADATA\XE\UNDO. SQL> ALTER TABLESPACE my_space OFFLINE NORMAL. This can be done by using the ALTER TABLESPACE . BYTES 2 FROM USER_FREE_SPACE BYTES --------104857600 461373440 94371840 356515840 10485760 5242880 . . ONLINE statement as shown in the following script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space.

Total System Global Area 100663296 bytes Fixed Size 1285956 bytes Variable Size 58720444 bytes Database Buffers 37748736 bytes Redo Buffers 2908160 bytes Database mounted. What you can do is to set the bad data file as offline befor opening the database. But it will not open the database. How Remove Data Files befor opening a Database? Let's say you have a corrupted data file or lost a data file.dbf is deleted. you accidently deleted a data file from the operating system. ORACLE instance shut down. TABLESPACE_NAME FILE_ID BYTES -----------------------------. What Happens If You Lost a Data File? After you shuting down an Oracle database. The following tutorial examples shows you what will happen if the data file c:\temp\my_space.see DBWR trace file ORA-01110: data file 5: 'C:\TEMP\MY_SPACE. ORACLE instance started. ORA-01157: cannot identify/lock data file 5 . The tutorial exercise shows you how to set two data files offline and open the database without them: >sqlplus /nolog SQL> connect SYSTEM/fyicenter AS SYSDBA SQL> STARTUP MOUNT.DBF' SQL> SHUTDOWN. . If you try to start the database again you will get error when Oracle tries to open the database after mounting the database. ORA-01109: database not open Database dismounted.3 WHERE TABLESPAE_NAME IN ('MY_SPACE'). Oracle can still start the database instance and mount the database. But it will fail on openning the database as shown below in a SQL*Plus session: >sqlplus /nolog SQL> connect SYSTEM/fyicenter AS SYSDBA SQL> STARTUP ORACLE instance started. Oracle can mount the database.---------MY_SPACE 6 5177344 MY_SPACE 5 10354688 This script created one tablespace with two data files.---------.

Here is how to do this with a special form of the "connect" command: (Log in with the same user you used to install 10g XE) >cd (OracleXE home directory) >. . FILE_NAME --------------------------------C:\ORACLEXE\ORADATA\XE\USERS.DBF C:\TEMP\MY_SPACE_2. FILE_NAME. SQL> ALTER DATABASE OPEN. BYTES FROM DBA_DATA_FILES.\bin\startdb >.DBF BYTES --------104857600 503316480 94371840 367001600 TABLESPACE_NAME --------------USERS SYSAUX UNDO SYSTEM MY_SPACE MY_SPACE How To Use Windows User to Connect to the Server? During the installation process. SQL> ALTER DATABASE DATAFILE '\temp\my_space_2.dbf' 2 OFFLINE DROP.DBF C:\ORACLEXE\ORADATA\XE\SYSTEM. Database altered.Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers Database mounted. Database altered. 10g XE will create a special Windows user group called ORA_DBA. This process is called connecting the server as SYSDBA with OS Authentication. the current Windows user will be trusted if he/she is in the ORA_DBA user group on the Windows system.\bin\sqlplus /nolog SQL> connect / AS SYSDBA Connected. Any Windows users in this group can be connected to Oracle server with SYSDBA privilege without any Oracle server user account. and put your Windows user into this group. SELECT TABLESPACE_NAME. Database altered.dbf' 2 OFFLINE DROP.DBF C:\TEMP\MY_SPACE. 100663296 1285956 58720444 37748736 2908160 bytes bytes bytes bytes bytes SQL> ALTER DATABASE DATAFILE '\temp\my_space.DBF C:\ORACLEXE\ORADATA\XE\UNDO.DBF C:\ORACLEXE\ORADATA\XE\SYSAUX. col tablespace_name format a16. SQL> SQL> SQL> 2 col file_name format a36. SQL> quit So if "connect" is used without user name and password.

you can log in as SYSTEM and use the ALTER USER command as shown in the following example: >. Try the following script: >. you can log in as SYSTEM and use the CREATE USER command as shown in the following example: >.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter Connected. Note that CREATE is a SQL statement.--------FLOWS_020100 35 07-FEB-06 FLOWS_FILES 34 07-FEB-06 HR 33 07-FEB-06 MDSYS 32 07-FEB-06 ANONYMOUS 28 07-FEB-06 XDB 27 07-FEB-06 CTXSYS 25 07-FEB-06 DBSNMP 23 07-FEB-06 TSMSYS 20 07-FEB-06 DIP 18 07-FEB-06 OUTLN 11 07-FEB-06 SYSTEM 5 07-FEB-06 SYS 0 07-FEB-06 How To Create a New User Account? If you want to create a new user account. SQL> CREATE USER DEV IDENTIFIED BY developer ACCOUNT UNLOCK.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter Connected. User created.". This command creates a user called "DEV". A simple SELECT statement can be used to get a list of all user accounts.---------. so you need to terminate it with ". How To Change User Password? If you want to change a user's password. with a password of "developer". USERNAME USER_ID CREATED -----------------------------.How To List All User Accounts? User accounts can be accessed through a system view called ALL_USERS.\bin\sqlplus /nolog . You can test this account by log in with DEV from SQL*Plus. SQL> SELECT * FROM ALL_USERS.

you will find out how Oracle denies connection: >. User created. SQL> ALTER USER DEV IDENTIFIED BY beginner. What Privilege Is Needed for a User to Connect to Oracle Server? Oracle deny connection to users who has no CREATE SESSION privilege. Note that ALTER is SQL statement. Try the following tutorial exercise. The following tutorial exercise shows you how to grant DEV the privilege to connect to the server: . User created. How To Delete a User Account? If you want to delete a user account and its associated schema.SQL> connect SYSTEM/fyicenter Connected. SQL> disconnect SQL> CONNECT DEV/developer ORA-01045: user DEV lacks CREATE SESSION privilege. This command resets DEV's password to "beginner". so you need to terminate it with ". How To Grant CREATE SESSION Privilege to a User? If you want give a user the CREATE SESSION privilege.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> CREATE USER DEV IDENTIFIED BY developer ACCOUNT UNLOCK. SQL> CREATE USER DEV IDENTIFIED BY developer ACCOUNT UNLOCK.". logon denied Oracle error message is pretty clear. User altered. you can log in as SYSTEM and use the DROP USER command as shown in the following example: >. SQL> DROP USER DEV CASCADE. you can use the GRANT command. Note that CASCADE tells the server drop the associated schema.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter Connected. User dropped.

SQL> disconnect SQL> CONNECT DEV/developer Connected. User altered. How To Revoke CREATE SESSION Privilege from a User? If you take away the CREATE SESSION privilege from a user. User altered. SQL> GRANT CREATE SESSION TO dev. Grant succeeded.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> ALTER USER dev ACCOUNT LOCK. This script restored the CREATE SESSION privilege to user "dev". so you can continue other example scripts below. you can use the REVOKE command as shown in the following example script: >. How To Lock and Unlock a User Account? If you want to lock a user account for a short period of time. and unlock it later. The following sample script shows how to use this command: >. ACCOUNT command.>.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> REVOKE CREATE SESSION FROM dev. you can use the ALTER USER . . Revoke succeeded.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> GRANT CREATE SESSION TO dev.. SQL> disconnect SQL> CONNECT DEV/developer ORA-28000: the account is locked SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> ALTER USER dev ACCOUNT UNLOCK. SQL> disconnect SQL> CONNECT DEV/developer Connected.. Grant succeeded.

. which is more powerful. If you want to change this. and allows the user to create tables in other user's schema. How To Assign a Tablespace to a Users? When you create a new user. you can assign a different table space to a user using the ALTER USER command. the user needs to have the CREATE TABLE privilege. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT CREATE TABLE TO dev. SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE TABLE fyi (id NUMBER). ORA-01950: no privileges on tablespace 'SYSTEM' The above error message tells that user "dev" is not allowed to use the tablespace "SYSTEM". See the next question for answers. Grant succeeded. Oracle will assign the SYSTEM tablespace to the user by default. The following tutorial exercise changes user dev's default tablespace. Table created. User altered. SQL> DROP TABLE fyi.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> ALTER USER dev DEFAULT TABLESPACE USERS. The following tutorial exercise gives you a good example on CREATE TABLE privilege: >. or the CREATE ANY TABLE privilege.What Privilege Is Needed for a User to Create Tables? To be able to create tables in a user's own schema. SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE TABLE fyi (id NUMBER). SQL> ALTER USER dev QUOTA 4M ON USERS.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> CREATE TABLE fyi (id NUMBER). and assigns 4MB of space to dev: >. User altered. Table dropped.

SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE VIEW fyi_view AS SELECT * FROM fyi. Grant succeeded. "dev" can create and drop tables now. As you can see. The following tutorial exercise gives you a good example on creating view privilege: >. You can also let "dev" to create tables in any tablespace without any restriction by granting him the UNLIMITED TABLESPACE system privilege. "dev" can create and drop views now. or the CREATE ANY VIEW privilege. the user needs to have the CREATE VIEW privilege. he/she needs the same privilege as the creating tables.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> GRANT CREATE TABLE TO dev. which is more powerful. Grant succeeded. Table created. View created. View created. Just make sure he/she has the CREATE TABLE privilege. The following tutorial exercise gives you a good example on CREATE VIEW privilege: >. . SQL> CREATE VIEW fyi_view AS SELECT * FROM fyi. What Privilege Is Needed for a User to Create Indexes? For a user to create indexes. As you can see.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> CREATE VIEW fyi_view AS SELECT * FROM fyi.SQL> CREATE TABLE fyi (id NUMBER). View dropped. What Privilege Is Needed for a User to Create Views? To be able to create views in a user's own schema. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT CREATE VIEW TO dev. SQL> DROP VIEW fyi_view. and allows the user to create views in other user's schema.

Grant succeeded. Index created. COUNT(*) ---------107 As you can see. The following tutorial exercise gives you a good example of granting "dev" to insert rows in "hr" schema: >. "dev" can query tables in any schema now.SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE INDEX fyi_index ON fyi(id). Index dropped. The following tutorial exercise gives you a good example of granting "dev" to query tables in "hr" schema: >. SQL> disconnect SQL> CONNECT DEV/developer SQL> SELECT COUNT(*) FROM hr. he/she needs the SELECT ANY TABLE privilege.employees.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> SELECT COUNT(*) FROM hr.employees. SQL> DROP INDEX fyi_index. Index created. he/she needs the INSERT ANY TABLE privilege. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT SELECT ANY TABLE TO dev. What Privilege Is Needed for a User to Query Tables in Another Schema? For a user to run queries (SELECT statements) on tables of someone else's schema. You also need to remember that table name must be prefixed with the schema name (same as owner user name).\bin\sqlplus /nolog . What Privilege Is Needed for a User to Insert Rows to Tables in Another Schema? For a user to insert rows into tables of someone else's schema. This exercise assumes that you followed previous exercises in the FAQ collection. SQL> CREATE INDEX fyi_index ON fyi(id).

"dev" can insert rows in any schema now.FYI'. 7700. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT INSERT ANY TABLE TO dev. "dev" can delete rows in any schema now. How To Find Out What Privileges a User Currently Has? . SQL> disconnect SQL> CONNECT DEV/developer SQL> DELETE FROM hr. What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema? For a user to delete rows from tables of someone else's schema. The following tutorial exercise gives you a good example of granting "dev" to delete rows in "hr" schema: >.jobs VALUES ('DV. 1 row created. 8800). 8800). But you should be careful when giving this privilege to a regular developer.FYI'.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> DELETE FROM hr. 'Dev FYI Consultant'. 7700.SQL> CONNECT DEV/developer SQL> INSERT INTO hr. But you should be careful when giving this privilege to a regular developer.jobs WHERE job_id = 'DV.jobs VALUES ('DV.jobs WHERE job_id = 'DV. 'Dev FYI Consultant'. Grant succeeded. As you can see. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT DELETE ANY TABLE TO dev. 1 row deleted. As you can see.FYI'. Grant succeeded. SQL> disconnect SQL> CONNECT DEV/developer SQL> INSERT INTO hr.FYI'. he/she needs the DELETE ANY TABLE privilege.

Privileges granted to users are listed in two system views: DBA_SYS_PRIVS, and USER_SYS_PRIVS. You can find out what privileges a user currently has by running a query on those views as shown in the tutorial exercise below:
>.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> SELECT username, privilege FROM USER_SYS_PRIVS; USERNAME PRIVILEGE ------------------------------ ---------------------DEV SELECT ANY TABLE DEV INSERT ANY TABLE DEV CREATE SESSION DEV CREATE VIEW DEV DELETE ANY TABLE DEV CREATE ANY TABLE SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT DELETE ANY TABLE TO dev; Grant succeeded. SQL> SELECT GRANTEE, PRIVILEGE WHERE GRANTEE = 'HR'; GRANTEE -----------------------------HR HR HR HR HR HR HR HR HR FROM DBA_SYS_PRIVS PRIVILEGE ----------------------CREATE VIEW UNLIMITED TABLESPACE DEBUG CONNECT SESSION CREATE DATABASE LINK CREATE SEQUENCE CREATE SESSION DEBUG ANY PROCEDURE ALTER SESSION CREATE SYNONYM

Looks like "hr" has move privileges than "dev". How To Create an Oracle Database? There are two ways to create a new database:
y y

Use the Database Configuration Assistant (DBCA) to create a database interactively. Use the CREATE DATABASE statement to create a database manually.

How To Create an Oracle Database Manually? Based on Oracle's Administrator Guide, there are 11 steps to create a database with the CREATE DATABASE statement:
y

Step 1: Decide on Your Instance Identifier (SID)

y y y y y y y y y y

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.

Other items in this FAQ collection will follow those steps to help you creating a new database manually from beginning to end. How To Select an Oracle System ID (SID)? This is Step 1. If you are planning to create a new database, you need to select an Oracle System ID (SID). This ID will be used to identify the new Oracle database and its Oracle instance. SID must be unique if you want to run multiple databases on a single server. Let's set SID for the new database to be: FYI. How To Establish Administrator Authentication to the Server? This is Step 2. There are two ways to establish administrator authentication to a new database.
y y

Use a password file. Use operating system (OS) authentication.

Using OS authentication is easier on Windows system. If you used your own Windows user account to install Oracle server, it will put your Windows user account into a special Window's user group called SYSDBA. This Window's user group will be fully trusted by Oracle server with SYSDBA privilege. To continue with other steps, make sure you logged into the Windows system with a user account in the SYSDBA group. How To Create an Initialization Parameter File? This is Step 3. To run an Oracle database as an Oracle instance, you need to create an initialization parameter file, which contains a set of initialization parameters. The easiest way to create an initialization parameter file to copy from the sample file provided by Oracle. You can do this in a command window as shown below:
>cd $ORACLE_HOME

>copy .\config\scripts\init.ora .\database\initFYI_ini.ora >edit .\database\initFYI_ini.ora (replace XE by FYI)

In this example, only the SID is changed from XE to FYI. All other parameters are maintained as is. How To Connect the Oracle Server as SYSDBA? This is Step 4. The best way to connect to the Oracle server as an administrator is to use SQL*Plus. You need to run SQL*Plus with /nolog option and use the CONNECT with blank user name, blank password and AS SYSDBA option. Here is a sample session:
>cd $ORACLE_HOME >.\bin\sqlplus /nolog SQL> CONNECT / AS SYSDBA Connected.

How To Create a Server Parameter File? This is Step 5. The initialization parameter file is good to get an Oracle database instance started. But it is not ideal run an instance as production. You need to convert the initialization parameter file into a Server Parameter File (SPFile) using the CREATE SPFILE statement. The script below shows you how do this:
SQL> CREATE SPFILE=$ORACLE_HOME/dbs/SPFILEFYI.ora 2 FROM PFILE=$ORACLE_HOME/database/initFYI_ini.ora; File created.

Note that $ORACLE_HOME should be replaced by the real path name where your Oracle server is intalled. The SPFile should be located in the expected directory and named as SPFILE($SID).ora. How To Start an Oracle Instance? This is Step 6. Now you are ready to start the new Oracle Instance without any database. This instance will be used to create a database. Starting an instance without database can be done by using STARTUP NOMOUNT statement as shown below:
>.\bin\sqlplus /nolog SQL> CONNECT / AS SYSDBA Connected. SQL> SHUTDOWN ORACLE instance shut down.

and there is a bad parameter in the XE instance SPFile.SQL> STARTUP NOMOUNT ORA-00821: Specified value of sga_target 16M is too small. But we can try to start the new instance with a minimal initialization parameter file (PFile). But the initialization parameter file created in Step 3 has some problem with the log directory. $ORACLE_HOME/database/initFYI_ini_min. How To Start Instance with a Minimal Initialization Parameter File? The sample initialization parameter file provided by Oracle seems to be not working.ora ORACLE instance started. First you can create another PFile.ora.dbf") undo_management=AUTO Then start the FYI instance again: SQL> CONNECT / AS SYSDBA Connected. SQL> STARTUP NOMOUNT PFILE=$ORACLE_HOME/database/initFYI_ini. The STARTUP NOMOUNT command failed because it tried to start the default instance XE.ora ORA-02778: Name given for the log directory is invalid The PFILE option allows you to specify the initialization parameter file of a specific Oracle instance.\bin\sqlplus /nolog SQL> CONNECT / AS SYSDBA Connected. SQL> STARTUP NOMOUNT PFILE=$ORACLE_HOME/database/initFYI_ini_min. See the next FAQ question to find another way to start the new instance FYI. . needs to be at least 20M The SHUTDOWN command is need to bring the default instance XE down. as shown below: db_name=FYI control_files=("\oraclexe\oradata\FYI\control. How To Start a Specific Oracle Instance? A simple way to start a specific Oracle instance is to start the instance with the PFILE option as shown in the following example: >.

They are caused by the missing directory for data files in file system.dbf' SIZE 32M REUSE DEFAULT TABLESPACE tbs_1 DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/oraclexe/oradata/FYI/temp01. You can modify and same it in a file. Here is how to run this long CREATE DATABASE statement: SQL> @$ORACLE_HOME\config\scripts\create_database_fyi.dbf' SIZE 32M REUSE EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/oraclexe/oradata/FYI/sysaux01. GROUP 3 ('/oraclexe/oradata/FYI/redo03.log') SIZE 10M. CREATE DATABASE FYI * ERROR at line 1: ORA-01501: CREATE DATABASE failed ORA-00200: control file could not be created ORA-00202: control file: 'C:\ORACLEXE\ORADATA\FYI\CONTROL. unable to create file OSD-04002: unable to open file O/S-Error: (OS 3) The system cannot find the path specified. But it is a long statement. Don't worry about the error messages.sql. Oracle Administrator Guide provided a sample CREATE DATABASE statement.Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 113246208 1286028 58720372 50331648 2908160 bytes bytes bytes bytes bytes How To Run CREATE DATABASE Statement? This is Step 7. $ORACLE_HOME/configscripts/create_database_fyi.log') SIZE 10M MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 MAXINSTANCES 1 CHARACTER SET US7ASCII NATIONAL CHARACTER SET AL16UTF16 DATAFILE '/oraclexe/oradata/FYI/system01. GROUP 2 ('/oraclexe/oradata/FYI/redo02. and run the file within SQL*Plus.dbf'SIZE 20M REUSE UNDO TABLESPACE undotbs DATAFILE '/oraclexe/oradata/FYI/undotbs01. Here is a copy of the modified CREATE DATABASE statement: CREATE DATABASE FYI USER SYS IDENTIFIED BY fyicenter USER SYSTEM IDENTIFIED BY fyicenter LOGFILE GROUP 1 ('/oraclexe/oradata/FYI/redo01.dbf' SIZE 20M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED.DBF' ORA-27040: file create error. .log') SIZE 10M.sql.

Creating additional tablespaces can be done by using the CREATE TABLESPACE statement as shown in the following sample script: SQL> CREATE TABLESPACE users 2 DATAFILE '/oraclexe/oradata/FYI/users01. you should create a dedicated directory for each Oracle database. Try the CREATE DATABASE statement again. How To Build Data Dictionary View an New Database? This is Step 9. when you have the directory ready. The Oracle Administrator Guide suggests to run two SQL scripts provided by Oracle as shown bellow: SQL> @/u01/oracle/rdbms/admin/catalog. How To Create Additional Tablespaces for an New Database? This is Step 8. Disconnection forced Something went wrong again. With the default instance called "XE" already defined.How To Do Clean Up If CREATE DATABASE Failed? To better organize data files. If your CREATE DATABASE statement failed half way again. This time it might related the limitation that Oracle 10g XE only supports one database instance.sql . Remove all files in FYI directory: \oraclexe\oradata\fyi\ Run STARTUP NOMOUNT PFILE command to start the empty instance again to be ready for CREATE DATABASE statement. How To Run CREATE DATABASE Statement Again? After cleaning up the results of a previously failed CREATE DATABASE statement.sql SQL> @/u01/oracle/rdbms/admin/catproc.dbf' SIZE 10M. creating another database instance might be not allowed. SQL> CREATE TABLESPACE indx 2 DATAFILE '/oraclexe/oradata/FYI/indx01. This can be done by using Windows file explorer to create the \oraclexe\oradata\fyi\ directory. you may have to clean up the partial result of the CREATE DATABASE statement.dbf' SIZE 10M. Here is a list of suggestions for you: y y y Run SHUTDOWN command to stop the partial started database instance.sql. CREATE DATABASE FYI * ERROR at line 1: ORA-01092: ORACLE instance terminated. you can run the CREATE DATABASE statement again as shown below: SQL> @$ORACLE_HOME\config\scripts\create_database_fyi.

. and dump all record from a table to a flat text file: >mkdir \oraclexe\test >sqlplus /nolog SQL> connect HR/fyicenter SQL> SET HEADING OFF.txt. It allows you to record SELECT query result to a text file on the operating system. . SQL> SET FEEDBACK OFF. SQL> SPOOL \oraclexe\test\employees. SQL> SELECT id ||'. How To Export Data with a Field Delimiter? The previous exercise allows you to export data with fixed field lengths.' delimited fields as shown here: . SQL> SET LINESIZE 1000. You should see all records in fyi_links.'|| created FROM fyi_links. Perform database administration..txt with '. .txt.txt with fixed length fields. Examine table and object definitions. you can concatenate your fields with an expression in the SELECT clause as shown in the tutorial exercise bellow: SQL> SET HEADING OFF. If you want export data with variable field lengths and field delimiters. The following tutorial exercise shows you how control the output format.'|| notes ||'.'|| counts ||'.. SQL> SPOOL OFF. SQL> SELECT * FROM EMPLOYEES. SQL> SPOOL OFF. and print from query results. store. It is an Oracle database client tool that works as a command-line user interface to the database server.'|| url ||'. SQL*Plus allows you: y y y y Format. SQL> SPOOL \oraclexe\test\fyi_links.What Is the Simplest Tool to Run Commands on Oracle Servers? The simplest tool to connect to an Oracle server and run commands to manage data is SQL*Plus. You should get all records in employees..... start the spooler... SQL> SET FEEDBACK OFF. Develop and run batch scripts.. What Is the Quickest Way to Export a Table to a Flat File? The quickest way to export a table to a flat file is probably to use the SQL*Plus SPOOL command. perform calculations on. SQL> SET LINESIZE 1000.

515.Lex. Can specify character set of the data.590.423.13-JAN-83. first_name VARCHAR(80) NOT NULL. The target table where the data should be loaded. What Is a SQL*Loader Control File? A SQL*Loader control file a text that defines how data files should be loaded into the database.4567 2.25-JUN-87. SQL*Loader is available as part of the free Oracle 10g Expression Edition.590.4560 8.4169 .4569 10.centerfyi. There is an input data file stored at \oraclexe\text\student.Nancy.124.Faviet..05-FEB-88. Select criteria to select input records for loading.423.com.Steven.17-JUN-77.4569 7.423.590. How input data fields should be mapped to target table columns.Valli.101. birth_date DATE NOT NULL.4567 5.Session 1. Where to output errors.Alexander.17-MAY-06 110. social_number VARCHAR(80) UNIQUE NOT NULL). bypassing normal record inserting process.515. Can generate sophisticated error reports.Ernst.03-JAN-80.124.4568 6.fyicenter.King.com.De Haan.Greenberg.123.590.07-FEB-89.423.423.123.Daniel.David.Hunold.5567 9.4569 4.21-MAY-81.515.515.Pataballa.4568 3. How To Load Data with SQL*Loader? Let's say you have a table defined as: CREATE TABLE student (id NUMBER(5) PRIMARY KEY.Lorentz.16-AUG-84. The format of the input date file.17-AUG-84.123.Bruce.515.21-SEP-79.Neena. Can load data directly to Oracle datafiles.txt with the following records: 1. It allows you to specify: y y y y y y Where is the input data file.Austin.Diana.17-MAY-06 What Is SQL*Loader? SQL*Loader is a database tool that allows to load data from external files into database tables.Session 1..Kochhar. It has some interesting features as: y y y y Can load data from multiple data files into multiple tables in one load session.590. last_name VARCHAR(80) NOT NULL.

data=\oraclexe\test\student.0\server\BIN >sqlldr userid=hr/fyicenter. you can run the SQL*Loader with the "sqlldr" command: >cd \oraclexe\app\oracle\product\10. . SELECT statement to load data from the external file to the regular table through the external table. Accessing data of external tables are done through data access drivers. social_number) When you are ready to load data. you should check the log file \oraclexe\test\student.1. Run an INSERT INTO .. External tables can be used to load data from external files into database.log.' (id. or unload data from database to external files. first_name.0.txt.ctl as: LOAD DATA APPEND INTO TABLE STUDENT FIELDS TERMINATED BY '. you can load it to database through an external table by the steps below: y y y Create an external table with columns matching data fields in the external file. Currently. birth_date.2. log=\oraclexe\test\student. What Are the Restrictions on External Table Columns? When creating external table columns.logical record count 10 To see details of the loading process. you need to watch out some restrictions: y y y "PRIMARY KEY" is not allowed. How To Load Data through External Tables? If you have data stored in external files. "DEFAULT value" is not allowed. last_name.ctl. Data of an external table is stored in files on the operating systems. "NOT NULL" is not allowed. control=\oraclexe\test\student.2. Oracle supports two data access drivers: ORACLE_LOADER and ORACLE_DATAPUMP.0 Commit point reached . What Is an External Table? An external table is a table defined in the database with data stored outside the database.log SQL*Loader: Release 10.You can create a control file at \oraclexe\test\student. Create a regular table with the same columns..

SQL> GRANT READ ON DIRECTORY test_dir TO hr. Directory created. How To Define an External Table with a Text File? You can use the CREATE TABLE statement to create external tables. notes VARCHAR2(16). and granted access permissions to different users. url VARCHAR2(16). SQL> DROP DIRECTORY temp_dir.---------- . Directory objects can be created. Grant succeeded. SQL> GRANT WRITE ON DIRECTORY test_dir TO hr. dropped. But you need to use ORGANIZATION EXTERNAL clause to specify the external file location and the data access driver. Directory created. Directory dropped.txt') ). Grant succeeded. The tutorial exercise below shows you how to define an external table as a text file: >sqlplus /nolog SQL> connect HR/fyicenter SQL> CREATE TABLE ext_fyi_links ( id NUMBER(4). counts NUMBER(4). created DATE ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY test_dir LOCATION ('ext_fyi_links. tablespace_name. SQL> SELECT table_name. TABLE_NAME TABLESPACE_NAME NUM_ROWS --------------------. The following tutorial exercise shows you some good examples: >sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> CREATE DIRECTORY test_dir AS '/oraclexe/test'. num_rows FROM USER_TABLES. Table created. SQL> CREATE DIRECTORY temp_dir AS '/oraclexe/temp'.What Is a Directory Object? A directory object is a logical alias for a physical directory path name on the operating system.---------------------.

SQL> SELECT * FROM fyi_links.dba.fyicenter Link #1 88 07-MAY-06 1110 dev.-------. url VARCHAR2(16) NOT NULL.Link #2.fyicenter.88. By default.88.'.Link #1. you can easily load data from this text file to a regular table.-------.----------.REGIONS LOCATIONS DEPARTMENTS JOBS EMPLOYEES JOB_HISTORY FYI_LINKS EXT_FYI_LINKS COUNTRIES USERS USERS USERS USERS USERS USERS USERS 4 23 27 19 107 10 2 25 How To Run Queries on External Tables? If you have an external table defined as a text file with the ORACLE_LOADER driver. data fields in the text file should be terminated by '.---------------. ID URL NOTES COUNTS CREATED --------. ID URL NOTES COUNTS CREATED --------.fyicenter Link #2 88 07-MAY-06 How To Load Data from External Tables to Regular Tables? Once you have your data entered in a text file. The following tutorial exercise shows you how to load data from the text file and the external table defined in the previous exercises to a regular table: SQL> CREATE TABLE fyi_links ( id NUMBER(4) PRIMARY KEY.--------101 fyicenter.----------. and query the text file through the external table. The tutorial exercise below shows you how add data to the external table defined in the previous exercise: >edit /oraclexe/test/ext_fyi_links. you can add data to the text file. created DATE DEFAULT (sysdate) ).--------1101 dba. and an external table defined to this text file.---------------. counts NUMBER(4).07-MAY-06 >sqlplus /nolog SQL> connect HR/fyicenter SQL> SELECT * FROM ext_fyi_links. 2 rows created.fyicenter.txt 1101.dev. SQL> INSERT INTO fyi_links SELECT * FROM ext_fyi_links.com Session 1 07-MAY-06 . notes VARCHAR2(16).07-MAY-06 1110.

The dump file set can be imported on the same system or it can be moved to another system and loaded there.fyicenter Session 1 Link #1 Link #2 07-MAY-06 88 07-MAY-06 88 07-MAY-06 What Is the Data Pump Export Utility? Oracle Data Pump Export utility is a standalone programs that allows you to export data objects from Oracle database to operating system files called dump file set. binary format. Because the dump files are written by the server. minimizing total elapsed time. and control information.fyicenter 1110 dev. The dump file set is made up of one or more disk files that contain table data.0\server\BIN >expdp help=y Export: Release 10.1. the data base administrator (DBA) must create directory objects. The files are written in a proprietary. Oracle dump file set is written in a proprietary binary format by the Data Pump Export utility. What Is the Data Pump Import Utility? Oracle Data Pump Import utility is a standalone programs that allows you to import data objects from an Oracle dump file set into Oracle database.2. rather than by the client. as determined by the import mode. Data Pump Import enables you to specify whether a job should move a subset of the data and metadata from the dump file set or the source database (in the case of a network import). During an import operation. you should go to the "bin" directory of your Oracle server installation and run the "expdp" command.0 The Data Pump export utility provides a mechanism for transferring data objects between Oracle databases. the Data Pump Import utility uses these files to locate each database object in the dump file set. This allows export and import operations to run concurrently.2.exe". This is done using data filters and metadata filters. To invoke this utility. Import can also be used to load a target database directly from a source database with no intervening dump files. which can be imported back to Oracle database only by Oracle Data Pump Import utility. The utility is invoked with the following command: .0. How To Invoke the Data Pump Export Utility? The Data Pump Export utility is distributed as executable file called "expdp.110 centerfyi.com 1101 dba. which are implemented through Import commands. database object metadata. This is known as a network import. Here is tutorial exercise on how to invoke the export utility: >cd \oraclexe\app\oracle\product\10.

Keyword Description (Default) -----------------------------------------------------------ATTACH Attach to existing job....valueN) Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott. e. To invoke this utility. The utility is invoked with the following command: Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott. Format: impdp KEYWORD=value or KEYWORD=(value1.2.. ...2.0.exe". you should go to the "bin" directory of your Oracle server installation and run the "impdp" command.dmp DIRECTORY=dmpdir SCHEMAS=scott or TABLES=(T1:P1. HELP Display Help messages (N).. FLASHBACK_SCN SCN used to set session snapshot back to.dmp ..dmp You can control how Export runs by entering the 'expdp' command followed by various parameters: Format: expdp KEYWORD=value or KEYWORD=(value1.0 The Data Pump Import utility provides a mechanism for transferring data objects between Oracle databases. FULL Export entire database (N)...0\server\BIN >impdp help=y Import: Release 10.value2.dmp You can control how Import runs by entering the 'impdp' command followed by various parameters. ATTACH [=job name COMPRESSION Reduce size of dumpfile contents where valid keyword values are: (METADATA_ONLY) and NONE.1.dmp).Example: expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott....g. How To Invoke the Data Pump Import Utitlity? The Data Pump Import utility is distributed as executable file called "impdp.T1:P2) USERID must be the first parameter on the command line. DIRECTORY Directory object to be used for dumpfiles DUMPFILE List of destination dump files (expdat.value2.valueN) Example: expdp scott/tiger DUMPFILE=scott. Here is tutorial exercise on how to invoke the import utility: >cd \oraclexe\app\oracle\product\10.

. Use the SCHEMAS parameter to specify this mode. estimated "FLOWS_020100".. . The following tutorial exercise shows you how a system user wants to see the disk space estimates on a full database export: >cd \oraclexe\app\oracle\product\10. Tablespace: Enables a privileged user to move metadata from the tables within a specified set of tablespaces from one Oracle database to another."WWV_FLOW_PAGE_PLUGS" 42 ..USERID must be the first parameter on the command line... Use the FULL parameter to specify this mode.. Use the TABLES parameter to specify this mode. Processing object DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA ..8 MB Job "SYSTEM"..... This is the default mode. . Schema: Enables you to export and import all objects that belong to a schema. How To Estimate Disk Space Needed for an Export Job? If you just want to know how much disk space for the dump without actually exporting any data.g. e. DUMPFILE List of dumpfiles to import from (expdat. you can use the ESTIMATE_ONLY=y parameter on the expdp command."WWV_FLOW_STEP_PROCESSING" 16 . estimated "FLOWS_020100". HELP Display help messages (N). estimated "TSMSYS". ATTACH [=job name] DIRECTORY Directory object to be used for dump. log."WWV_FLOW_STEP_ITEMS" 27 . estimated "SYSTEM"."SYS_EXPORT_FULL_01": SYSTEM/**** FULL=y ESTIMATE_ONLY=y Estimate in progress using BLOCKS method. Keyword Description (Default) ---------------------------------------------------------ATTACH Attach to existing job.."SRS$" 0 Total estimation using BLOCKS method: 169. Oracle 10g supports 5 export and import modes: y y y y y Full: Exports and imports a full database.. estimated "FLOWS_020100". What Are Data Pump Export and Import Modes? Data pump export and import modes are used to determine the type and portions of database to be exported and imported.. Use the TABLESPACES parameter to specify this mode..0\server\BIN >expdp SYSTEM/fyicenter FULL=y ESTIMATE_ONLY=y Starting "SYSTEM". Use the TRANSPORT_TABLESPACES parameter to specify this mode.2."SYS_EXPORT_FULL_01" successfully completed MB MB MB KB KB . Table: Enables you to export and import specific tables and partitions.dmp) FULL Import everything from source (Y). Tablespace: Enables a privileged user to move a set of tablespaces from one Oracle database to another."SQLPLUS_PRODUCT_PROFILE" 0 .

as shown in the following tutorial exercise: >expdp SYSTEM/fyicenter FULL=y ESTIMATE_ONLY=y Starting "SYSTEM".."SYS_EXPORT_FULL_01" successfully completed Where Is the Export Dump File Located? If you are not specifying the dump directory and file name. Oracle also records the screen output in a log file called export. Processing object DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA Total estimation using BLOCKS method: 169. exported FLOWS_020100. . exported FLOWS_020100.2. you can use the FULL=y parameter on the expdp command.------------------------------------SYS DATA_PUMP_DIR \oraclexe\app\oracle\admin\XE\dpdump\ SYS TEST_DIR /oraclexe/test SYS ORACLECLRDIR \oraclexe\app\oracle\product\10..17MB .WWV_FLOW_PAGE_PLUGS 32.68MB .WWV_FLOW_STEP_PROCESSING 11. . SQL> COL directory_name FORMAT A16.. SQL> COL directory_path FORMAT A40. Master table "SYSTEM". ...Now you know that you need 170 MB disk space to export the entire data base. OWNER DIRECTORY_NAME DIRECTORY_PATH ----. How To Do a Full Database Export? If you are ready to do a full database export.. . The tutorial exercise below tells you find what is your default dump directory and locate the dump file."SYS_EXPORT_FULL_01": SYSTEM/**** FULL=y Estimate in progress using BLOCKS method. SQL> SELECT * FROM dba_directories..0\ server\bin\clr ....DMP Job "SYSTEM". the dump file will be stored in the default dump directory with the default file name.SYS_EXPORT_FULL_01 is: C:\ORACLEXE\APP\ORACLE\ADMIN\XE\DPDUMP\EXPDAT.8 MB Processing object type DATABASE_EXPORT/TABLESPACE Processing object type DATABASE_EXPORT/SYS_USER/USER Processing object type DATABASE_EXPORT/SCHEMA/USER ."SYS_EXPORT_FULL_01" unloaded ********************************************************** Dump file set for SYSTEM.-------------..51MB .log at \oraclexe\app\oracle\admin\XE\dpdump..WWV_FLOW_STEP_ITEMS 21. >sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> COL owner FORMAT A8. exported FLOWS_020100.

."EMPLOYEES_TEMP" 15. Grant succeeded. .. Master table "HR".Obviously. exported "HR".632 KB 27 rows .. the default dump directory is directory object defined to \oraclexe\app\oracle\admin\XE\dpdump\. Running "expdp" command with a non-system user account requires a directory object granted to this user account..2."SYS_EXPORT_SCHEMA_01": hr/******** SCHEMAS=hr DIRECTORY=hr_dump DUMPFILE=schema. SQL> GRANT WRITE ON DIRECTORY hr_dump TO hr. you will find the full database dump file is called "expdat."EMPLOYEES" 15. . Grant succeeded..76 KB 107 rows . SQL> GRANT READ ON DIRECTORY hr_dump TO hr.."DEPARTMENTS" 6. SQL> quit >expdp hr/fyicenter SCHEMAS=hr DIRECTORY=hr_dump DUMPFILE=schema. Directory created.log Estimate in progress using BLOCKS method. The following tutorial exercise shows you how to define a directory object and export a schema: >mkdir \oraclexe\hr_dump >cd \oraclexe\app\oracle\product\10. exported "HR"."SYS_EXPORT_SCHEMA_01" loaded/unloaded ********************************************************* Dump file set for HR.dmp LOGFILE=schema."SYS_EXPORT_SCHEMA_01" successfully completed .86 KB 107 rows . Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 960 KB Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCH Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE Processing object type SCHEMA_EXPORT/TABLE/TABLE .dmp LOGFILE=schema. exported "HR". .. If you go to that directory.DMP Job "HR".dmp"..log Starting "HR". exported "HR".085 KB 25 rows ..0\server\BIN >sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> CREATE DIRECTORY hr_dump AS '\oraclexe\hr_dump'."COUNTRIES" 6. How To Export Your Own Schema? If you have a non-system user account and you want to export all data objects in the schema associated with your account... . .SYS_EXPORT_SCHEMA_01 is: C:\ORACLEXE\HR_DUMP\SCHEMA.. you can use the "expdp" command with the SCHEMAS parameter.

All dependent metadata and data will be skipped due to table_exists_action of skip Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX .0\server\BIN >expdp hr/fyicenter TABLES=employees.DMP Job "HR". The following exercise shows you a good example: >cd \oraclexe\app\oracle\product\10. the Data Pump Import utility will return an error and skip this table..dmp LOGFILE=tables."SYS_EXPORT_TABLE_01" successfully completed What Happens If the Imported Table Already Exists? If the import process tries to import a table that already exists.departments DIRECTORY=hr_dump DUMPFILE=tables.. Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 128 KB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CON.departments DIRECTORY=hr_dump DUMPFILE=tables.log Estimate in progress using BLOCKS method.How To Export Several Tables Together? If you don't want to export the entire schema and only want to export several tables only.. exported "HR". Processing object type TABLE_EXPORT/TABLE/COMMENT Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF... .dmp LOGFILE=tables.SYS_EXPORT_TABLE_01 is: C:\ORACLEXE\HR_DUMP\TABLES..0\server\BIN >impdp hr/fyicenter TABLES=employees DIRECTORY=hr_dump DUMPFILE=tables.2."DEPARTMENTS" 6.dmp LOGFILE=tables. you can use the "expdp" command with the "TABLES" parameter as shown in the following tutorial exercise: >cd \oraclexe\app\oracle\product\10.632 KB 27 rows .dmp LOGFILE=tables.log Processing object type TABLE_EXPORT/TABLE/TABLE ORA-39151: Table "HR".2."EMPLOYEES" 15... ."SYS_IMPORT_TABLE_01" loaded/unloaded Starting "HR". exported "HR"..log Master table "HR". Processing object type TABLE_EXPORT/TABLE/TRIGGER Processing object type TABLE_EXPORT/TABLE/STATISTICS/TAB."SYS_IMPORT_TABLE_01": hr/** TABLES=employees DIRECTORY=hr_dump DUMPFILE=tables. ....."EMPLOYEES" exists.76 KB 107 rows Master table "HR". Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTI."SYS_EXPORT_TABLE_01": hr/******** TABLES=employees.. ."SYS_EXPORT_TABLE_01" loaded/unloaded *********************************************************** Dump file set for HR..log Starting "HR".

The following tutorial exercise shows you how to import the "fyi_links" table from a dump file created by a schema export: >cd \oraclexe\app\oracle\product\10. objects (such as tables) are extracted. if any.log Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA ..log Master table "HR". Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TAB..375 KB 4 rows Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CON.dmp LOGFILE=tables. imported "HR".2. Export and Import utilities are now being replaced by Data Pump Export and Import utilities in Oracle 10g."FYI_LINKS" 6."SYS_IMPORT_TABLE_01": hr/** TABLES=fyi_links DIRECTORY=hr_dump DUMPFILE=schema."SYS_IMPORT_TABLE_01" successfully completed. . comments. SQL> exit."SYS_IMPORT_TABLE_01" loaded/unloaded Starting "HR". Job "HR". When you run Export against an Oracle database..dmp LOGFILE=tables. An export file is an Oracle binary-format dump file that is typically located on disk or tape. The extracted data is written to an export dump file. schema export or a table export. What Are the Original Export and Import Utilities? Oracle original Export and Import utilities are standalone programs that provide you a simple way for you to transfer data objects between Oracle databases. >impdp hr/fyicenter TABLES=fyi_links DIRECTORY=hr_dump DUMPFILE=schema. even if they reside on platforms with different hardware and software configurations. . The files can then be used with the Import utility to transfer data between databases that are on systems not connected through a network. and grants). The Import utility reads the object definitions and table data from the dump file.How To Import One Table Back from a Dump File? If you only want to import one table back to the database. The dump files can be transferred using FTP or physically transported (in the case of tape) to a different site... followed by their related objects (such as indexes. Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTI.. you can use a dump file that was created by full export. The files can also be used as backups in addition to normal backup procedures.0\server\BIN >sqlplus /nolog SQL> connect HR/fyicenter SQL> DROP TABLE fyi_links. But you can still use them. Table dropped.

How To Invoke the Original Export Import Utilities? If you really want to run the original export import utilities.. you use: Format: EXP KEYWORD=value or KEYWORD=(value1. When you install an Oracle server or a client tools on your Windows system. you can control how Export runs by entering the EXP command followed by various arguments.... >imp help=y . The tutorial exercise below tells you how to run the export and import utilities in help modes: >cd \oraclexe\app\oracle\product\10.. If you want to install a specific ODBC driver.oracle. if T1 is partitioned table ...DEPT.0\server\BIN >exp help=y You can let Export prompt you for parameters by entering the EXP command followed by your username/password: Example: EXP SCOTT/TIGER Or..2. Open Database Communication. you need to go to http://www.valueN) Example: EXP SCOTT/TIGER GRANTS=Y TABLES=(EMP.T1:P2)... What Is Open Database Communication (ODBC)? ODBC. To specify parameters. How To Install Oracle ODBC Drivers? Oracle offers different ODBC drivers for different versions of Oracle servers.MGR) or TABLES=(T1:P1.. you can still go to "bin" directory of the Oracle server path and run the "exp" or "imp" command. a standard API (application program interface) developed by Microsoft for Windows applications to communicate with database management systems. the appropriate ODBC driver will be installed for you automatically.value2..html. Download the right ODBC driver and follow the instructions to install it. Oracle offers ODBC drivers to allow Windows applications to connect Oracle server through ODBC.com/technology/software/tech/windows/odbc/index... .

Run Data Sources (ODBC).How To Find Out What Oracle ODBC Drivers Are Installed? To find out what Oracle ODBC drivers are installed on your Windows system. becaused offers ODBC drivers to support the ODBC API. Go to System DSN tab. Go to Administrative Tools. For example. Oracle ODBC drivers should be on the list. A Windows application can connect to an Oracle server indirectly through Windows ODBC manager. if it knows how to use the Oracle TNS technology. you can use the ODBC manager to look at them: y y y y y Go to Control Panel. Click the Add button. You should a list of all ODBC drivers installed on your system. your installed ODBC driver list could look like the one the picture bellow with two Oracle ODBC drivers. "Oracle in OraClient10g_home1" and "Oracle in XE": How Can Windows Applications Connect to Oracle Servers? A Windows application can connect to an Oracle server directly. The diagram below shows how MS Access can connect to an Oracle server through the ODBC driver: .

SQL> connect fyi/retneciyf.How To Create Tables for ODBC Connection Testing? If you want to follow the tutorial exercises in the sections below. SQL> CREATE USER fyi IDENTIFIED BY retneciyf ACCOUNT UNLOCK. SQL> ALTER USER fyi DEFAULT TABLESPACE USERS. you need to create a user account and a table for ODBC connection testing as shown here: SQL> CONNECT system/retneciyf Connected. User altered. Grant succeeded. SQL> GRANT CREATE TABLE TO fyi. SQL> GRANT CREATE SESSION TO fyi. How To Check the Oracle TNS Settings? If you have installed an Oracle server or an Oracle client tool on your local system. SQL> ALTER USER dev QUOTA 4M ON USERS. to define Oracle connect identifiers. INTO dev_faq VALUES (3). Connected. User altered. . User created. the TNS is automatically installed with a simple configuration file. tnsnames.ora. INTO dev_faq VALUES (7). INTO dev_faq VALUES (5). SQL> SQL> SQL> SQL> CREATE INSERT INSERT INSERT TABLE dev_faq (id NUMBER). Grant succeeded.

ora located at \oraclexe\app\oracle\product\10. you will have the tnsnames. Enter User Name: fyi. Go to Administrative Tools. Click the Test Connection button. if you have Oracle XE server installed. Enter Data Source Name: FYI_DSN.0\server\NETWORK\ADMIN. Go to System DSN tab. You should see a "Connection successful" as shown in the following picture: . Enter Description: FYIcenter DSN Oracle Setting. Enter TNS Service Name: XE. It should contain a connect identifier called XE defined as: XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost) (PORT = 1521) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) ) How To Define a Data Source Name (DSN) in ODBC Manager? DSN (Data Source Name) is an ODBC connection identifier for Windows applications. Click the Add button. Here is how you can define a DSN on your Windows system: y y y y y y y y y y y y y Go to Control Panel.For example. Click the OK button. Select the "Oracle in XE" driver. Run Data Sources (ODBC).2. Enter Password: retneciyf.

Enter User Name: fyi. Go to File menu... You should see the DSN name "FYI_DSN" you defined earlier. Select Import. The Select Data Source dialog box shows up.How To Connect MS Access to Oracle Servers? Once you got a DSN defined in the ODBC manager that connects to an Oracle server. You should see the Oracle ODBC Driver Connect dialog box as shown in the picture below: . The Import dialog box shows up. Select Get External Data. Click the Machine Data Source tab. Select "FYI_DSN". Enter Password: retneciyf.. The tutorial below gives you a good example: y y y y y y y y y Start MS Access with a new database file. and link an Access table to Oracle table. you can connect a normal MS Access document to the Oracle server. Select Files of type: ODBC Database().

Open "DSN=FYI_DSN.Execute("SELECT * FROM dev_faq") .CreateObject("ADODB. The tutorial example below gives you a good example: <% Set oConn = Server. you can get data from Oracle servers into your ASP pages through ODBC drivers.PWD=retneciyf" Set oRS = oConn. you need to install the correct Oracle ODBC driver and define a DSN on the IIS Web server. To do this.UID=fyi. Then you can use ADODB objects to connect to the Oracle server over the ODBC driver in your ASP pages. You should see a list of tables available for you to import from the Oracle server as shown in the picture below: How To Connect ASP Pages to Oracle Servers? If you are running Windows IIS Web server and serving ASP Web pages.Click the OK button to continue.Connection") oConn.

2. how can it be restored to optimal? Level: Low Expected answer: Use the ALTER TABLESPACE . the error is ignored and the tables data will be inserted.Write(oRS("ID") & vbcrlf) oRS.. If it is specified. What is the purpose of the IMPORT option IGNORE? What is it's default setting? Level: Low Expected Answer: The IMPORT IGNORE option tells import to ignore "already exists" errors. SHRINK command. If it is not specified the tables that already exist will be skipped. 3.close %> DBA 1. You have a rollback segment in a version 7.MoveNext Loop Response.. or COPY..2 database that has expanded beyond optimal..close oConn.. This is bad because it causes user objects and temporary segments to be placed into the SYSTEM tablespace resulting in fragmentation and improper table placement (only data dictionary objects and the system rollback segment should be in SYSTEM).Response. 4.. CREATE TABLE.write("<p>Data from Oracle server via ODBC:") Response. AS SELECT. Give one method for transferring a table from one schema to another: Level:Intermediate Expected Answer: There are several possible methods. export-import.EOF Response. If the DEFAULT and TEMPORARY tablespace clauses are left out of a CREATE USER command what happens? Is this bad or good? Why? Level: Low Expected answer: The user is assigned the SYSTEM tablespace as a default and temporary tablespace. The default value is N.write("<pre>") Do While NOT oRS.write("</pre>") oRS. .

Since this will usually be the same tablespace as the table is being created in. DBMS_OUTPUT and DBMS_SNAPSHOT. DBMS_SESSION.SQL or CAT*. What happens if a primary key constraint is disabled and then enabled without fully specifying the index clause? Level: Intermediate Expected answer: The index is created in the user?s default tablespace and all sizing information is lost.SQL series of SQL procedures. 9. What is the proper method for disabling and re-enabling a primary key constraint? Level: Intermediate Expected answer: You use the ALTER TABLE command for both. However. What happens if the constraint name is left out of a constraint clause? Level: Low Expected answer: The Oracle system will use the default name of SYS_Cxxxx where xxxx is a system generated number. 6. but only as part of the index definition. This is bad since it makes tracking which table the constraint belongs to or what the constraint does harder. this can cause serious performance problems. DBMS_DDL. for the enable clause you must specify the USING INDEX and TABLESPACE clause for primary keys. (On UNIX) When should more than one DB writer process be used? How many should be used? Level: High . DBMS_UTILITY. Oracle doesn?t store this information as a part of the constraint definition. These can be viewed as extra credit but aren?t part of the answer. 10. 7. when the constraint was disabled the index was dropped and the information is gone.5. They may also try to answer with the UTL*. DBMS_SQL. The packages used by DBAs may include: DBMS_SHARED_POOL. What are some of the Oracle provided packages that DBAs should be aware of? Level: Intermediate to High Expected answer: Oracle provides a number of packages in the form of the DBMS_ packages owned by the SYS user. What happens if a tablespace clause is left off of a primary key constraint clause? Level: Low Expected answer: This results in the index that is automatically generated being placed in then users default tablespace. 8.

A user is getting an ORA-00942 error yet you know you have granted them permission on the table.emp. 13. You can't create a stored object with grants given through a role. A developer is trying to create a view and the database won?t let him.emp.Expected answer: If the UNIX system being used is capable of asynchronous IO then only one is required. 11.) 15. can you recover in the event of a failure? Why or why not? Level: High Expected answer: You can't use hot backup without being in archivelog mode. depending upon whether you own or only have permission on the view or are using a DBA account. How can you tell if a database object is invalid? Level: Low Expected answer: By checking the STATUS column of the DBA_. 12. What causes the "snapshot too old" error? How can this be prevented or mitigated? Level: Intermediate Expected answer: This is caused by large or long running transactions that have either wrapped onto their own rollback space or have had another transaction write on part of their rollback space. You are using hot backup without being in archivelog mode. .) or has a synonym that points to the object (CREATE SYNONYM emp FOR scott. you couldn't recover. ALL_ or USER_OBJECTS views. So no. instead of SELECT empid FROM emp. what else should you check? Level: Low Expected answer: You need to check that the user has specified the full name of the object (SELECT empid FROM scott. This can be prevented or mitigated by breaking the transaction into a set of smaller transactions or increasing the size of the rollback segments and their extents. He has the "DEVELOPER" role which has the "CREATE VIEW" system privilege and SELECT grants on the tables he is using. what is the problem? Level: Intermediate Expected answer: You need to verify the developer has direct grants on all tables used in the view. if the system is not capable of asynchronous IO then up to twice the number of disks used by Oracle number of DB writers should be specified by use of the db_writers initialization parameter. 14.

but this only works against a single instance installation. 17. single column table that should only have one value in it.7 or so) then the index should be rebuilt.3. This table is a single row.0 (i. Another if you are on UNIX is to do a "ps -ef|grep oracle|wc -l? command. What is the problem? Level: Intermediate Expected answer: Somehow two values have been inserted into the dual table. The quick and dirty way is to look at the number of blocks the table is actually using and ratio the number of rows in the table to its number of blocks against the number of expected rows. Another way is to check the current_logins parameter in the v$sysstat view. 19. Or if the ratio BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0. greater than 0. 18. Define OFA. . Level: Low Expected answer: OFA stands for Optimal Flexible Architecture.16. One is to look at the v$session or v$process views. what is the best way to get sizing data for the production table implementation? Level: Intermediate Expected answer: The best way is to analyze the table and then use the data provided in the DBA_TABLES view to get the average row length and other pertinent data for the calculation.e. How can you find out how many users are currently logged into the database? How can you find their operating system id? Level: high Expected answer: There are several ways. his select is: SELECT pk_seq. It is a method of placing directories and files in an Oracle system so that you get the maximum flexibility for future tuning and file placement.nextval FROM dual. Installation/Configuration 1. If you have an example table. How can you determine if an index needs to be dropped and rebuilt? Level: Intermediate Expected answer: Run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn?t near 1. A user selects from a sequence and gets back two values.

What must be installed with ODBC on the client in order for it to work with Oracle? Level: Intermediate Expected answer: SQLNET and PROTOCOL (for example: TCPIP adapter) layers of the transport programs. They should indicate how they will handle archive logs and exports as well. ROLLBACK tablespace on another and still have two for DATA and INDEXES. what should you check first to determine if there is a problem? Level: Intermediate to high Expected Answer: Check to make sure that the archiver isn?t stuck. data and indexes and isolation os SYSTEM tables from other tables. As long as they have a logical plan for combining or further separation more or less disks can be specified.2. When configuring SQLNET on the server what files must be set up? Level: Intermediate Expected answer: INITIALIZATION file. Be sure enough contiguous disk space is available. 4. An example would be to specify that at least 7 disks should be used for an Oracle installation so that you can place SYSTEM tablespace on one.ORA. SQLNET. . How do you set up your tablespace on installation? Level: Low Expected answer: The answer here should show an understanding of separation of redo and rollback. When configuring SQLNET on the client what files need to be set up? Level: Intermediate Expected answer: SQLNET. You have installed Oracle and you are now setting up the actual instance.ORA 7. 3.ORA file 6. TNSNAMES. You have been waiting an hour for the initialization script to finish. 5. redo logs on two (mirrored redo logs) the TEMPORARY tablespace on another. If archive logging is turned on during install a large number of logs will be created. What should be done prior to installing Oracle (for the OS and the disks)? Level: Low Expected Answer: adjust kernel parameters or OS tuning parameters in accordance with installation guide.ORA file. This can fill up your archive log destination causing Oracle to stop to wait for more space. TNSNAMES.

You have just started a new instance with a large SGA on a busy existing server. When should the default values for Oracle initialization parameters be used as is? Level: Low Expected answer: Never 11. USER. The redo logs should not be on raw devices on UNIX if it can be avoided. 13. uniform IO and access requirements). see disk configuration answer above. Be sure they say on separate disks. df.e. How many disks should you have assuming standard layout for SYSTEM. not just file systems.8. You have a simple application with no "hot" tables (i. what should you check for? Level: Intermediate Expected answer: The first thing to check with a large SGA is that it isn?t being swapped out. How can you determine the space left in a file system? Level: Low Expected answer: There are several commands to do this: du. How many redo logs should you have and how should they be configured for maximum recoverability? Level: Intermediate Expected answer: You should have at least three groups of two redo logs with the two logs each on a separate disk spindle (mirrored by Oracle). TEMP and ROLLBACK tablespaces? Expected answer: At least 7. What OS user should be used for the first part of an Oracle installation (on UNIX)? Level: low Expected answer: You must use root first. UNIX 1. How many control files should you have? Where should they be located? Level: Low Expected answer: At least 2 on separate disk spindles. 9. 10. Performance is terrible. or bdf . 12.

Most UNIX systems should have a scheduled periodic reboot so file systems can be checked and cleaned and dead or zombie processes cleared out. The system has a program that always includes the word nocomp in its name. usually a case-esac or an if-endif or fi structure 7. How can you determine the number of SQLNET users logged in to the UNIX system? Level: Intermediate Expected answer: SQLNET users will show up with a process unique name that begins with oracle. It is stored in both disk and memory and tracts file status. how can you determine the number of processes that are using this program? Level: intermediate Expected answer: ps -ef|grep *nocomp*|wc -l 9. How can you find your id on a system? Level: Low Expected answer: Use the "who am i" command. This can be done using the pipe symbol "|". How can you find dead processes? Level: Intermediate Expected answer: ps -ef|grep zombie -. What is the purpose of the grep command? Level: Low Expected answer: grep is a string search command that parses the specified string from the specified file or files 8. The system administrator tells you that the system hasn?t been rebooted in 6 months.2. Inode problems and dead user processes can accumulate causing possible performance and corruption problems. 12. if you do a ps -ef|grep oracle|wc -l you can get a count of the number of users. What command is used to type files to the screen? Level: Low Expected answer: cat. 11. Some UNIX systems don?t clean up well after themselves. Can you remove an open file under UNIX? Level: Low Expected answer: yes 6. more. 3. pg 4. the greater than symbol ">" or the "tee" command.who -d depending on the system. should he be proud of this? Level: High Expected answer: Maybe. 10. This is one of the strengths of UNIX allowing the output from one command to be redirected directly into the input of another command. What is redirection and how is it used? Level: Intermediate Expected answer: redirection is the process by which input or output to or from a process is redirected to another process. There is one inode for each file on the system. . What is an inode? Level: Intermediate Expected answer: an inode is a file status indicator. What command is used to remove a file? Level: Low Expected answer: rm 5. How do you create a decision tree in a shell script? Level: intermediate Expected answer: depending on shell. How can you find all the processes on your system? Level: Low Expected answer: Use the ps command 14.or -. 13.

The file must already have been created. Connect internal only. until freed What is the . other protocols have similar command formats. Users from the PC clients are getting messages indicating : Level: Low ORA-06114: (Cnct err. For example. The following message is received: Level: Intermediate ORA-00257 archiver is stuck. restart the instance. You can use the command "tcpctl status" to get a full status of the V1 TCPIP server. 6. 16.15. How can you determine if the SQLNET process is running for SQLNET V1? How about V2? Level: Low Expected answer: For SQLNET V1 check for the existence of the orasrv process.dbf file. Users from the PC clients are getting the following error stack: Level: Low ERROR: ORA01034: ORACLE not available ORA-07318: smsget: open error when opening sgadef. dbwr and lgwr. For SQLNET V2 check for the presence of the LISTENER process(s) or you can issue the command "lsnrctl status". these will be smon. See Servr Msgs & Codes Manual) What could the problem be? Expected answer: The instance name is probably incorrect in their connection string. What is the finger command? Level: Low Expected answer: The finger command uses data in the passwd file to give information on system users. pmon. It is located in the directory specified by the background_dump_dest parameter in the v$parameter table.ora log. What is the easiest method to create a file on UNIX? Level: Low Expected answer: Use the touch command 17. can't get err txt. Any answer that has them using their operating system process showing feature to check for these is acceptable. How can you determine if an Oracle instance is up from the operating system level? Level: Low Expected answer: There are several base Oracle processes that will be running on multiuser operating systems. on UNIX a ps -ef|grep pmon will show what instances are up. 2. 18. 4. What does >> do? Level: Intermediate Expected answer: The ">>" redirection symbol appends the output from the command specified into the file specified. If you aren?t sure what command does a particular UNIX function what is the best way to determine the command? Expected answer: The UNIX man -k command will search the man pages for the value specified. [edit] Oracle Troubleshooting 1. Review the results from the command to find the command of interest. HP-UX Error: 2: No such file or directory What is the probable cause? Expected answer: The Oracle instance is shutdown that they are trying to access. 5. What file will give you Oracle instance status information? Where is it located? Level: Low Expected answer: The alert. Users aren?t being allowed on the system. 3.

smon will not coalesce their free space. 10.. 7. you must check the alert. they will need to know all of the datafiles. command. backup the archive logs and remove them and the archiver will re-start. 11..log file for this information.. You look at your fragmentation report and see that smon hasn?t coalesced any of you tablespaces. up to the value of MAX_DATAFILES as specified at database creation.problem? Expected answer: The archive destination is probably full. you will have to rebuild the control file to increase it before proceeding. and settings for MAXLOGFILES.. You attempt to add a datafile and get: Level: Intermediate ORA-01118: cannot add anymore datafiles: limit of 40 exceeded What is the problem and how can you fix it? Expected answer: When the database was created the db_files parameter in the initialization file was set to 40. However. 8. He has corrupted all of the control files while playing with the ALTER DATABASE BACKUP CONTROLFILE command. If no backup of the control file is available then the following will be required: CONNECT INTERNAL STARTUP NOMOUNT CREATE CONTROL FILE . You can shutdown and reset this to a higher value.. You get a call from you backup DBA while you are on vacation. you can have them wait and then try again later and the error should clear.. If you are sure that this is just a temporary problem. then restart If they have a recent output file from the ALTER DATABASE BACKUP CONTROL FILE TO TRACE.. Where would you look to find out if a redo log was corrupted assuming you are using Oracle mirrored redo logs? Level: Intermediate Expected answer: There is no message that comes to the SQLDBA or SRVMGR programs during startup in this situation.) RECOVER DATABASE USING BACKUP CONTROLFILE ALTER DATABASE OPEN RESETLOGS. they can use that to recover as well. What do you do? Level: High Expected answer: As long as all datafiles are safe and he was successful with the BACKUP controlfile command you can do the following: CONNECT INTERNAL STARTUP MOUNT (Take any read-only tablespaces offline before next step ALTER DATABASE DATAFILE . Increase the value of DML_LOCKS. MAXDATAFILES for the database to use the command . If pct_increase is zero. If the MAX_DATAFILES is set to low. MAXLOGHISTORY. Your users get the following error: Level: Intermediate ORA-00055 maximum number of DML locks exceeded What is the problem and how do you fix it? Expected answer: The number of DML Locks is set by the initialization parameter DML_LOCKS. even though you know several have large chunks of contiguous free extents. logfiles. 9.. What is the problem? Level: High Expected answer: Check the dba_tablespaces view for the value of pct_increase for the tablespaces. OFFLINE. If this value is set to low (which it is by default) you will get this error. (bring read-only tablespaces back online) Shutdown and backup the system. MAXLOGMEMBERS.

Oracle RAC(Real Application Cluster) DBA Interview Questions What is RAC? RAC stands for Real Application cluster. They are composed of Memory structures and background processes same as the single instance database. To enable inter instance communication Oracle RAC makes use of interconnects. When a block of data is read from datafile by an instance within the cluster and another instance is in need of the same block.In an Oracle RAC environment ACMS is an agent that ensures a distributed SGA memory update(ie)SGA updates are globally committed on success or globally aborted in event of a failure. media failover features.The database autotunes the number of these processes based on the workload of XA global transactions. This process manages incoming remote resource requests within each instance.Oracle RAC instances use two processes GES(Global Enqueue Service). The GES and GCS maintains records of the statuses of each datafile and each cahed block using global resource directory. Give details on LMON:This process monitors global enques and resources across the cluster and performs global enqueue recovery operations. Give details on LMS:This process is called as Global Cache service process. The Global Enqueue Service(GES) monitors and Instance enqueue process manages the cahce fusion. Mention the Oracle RAC software components:Oracle RAC is composed of two or more database instances. Give Details on Cache Fusion:Oracle RAC is composed of two or more instances. Give details on LMD:This process is called as global enqueue service daemon. It is a clustering solution from Oracle Corporation that ensures high availability of databases by providing instance failover.This process maintains statuses of datafiles and each cahed block by recording information in a Global Resource . Give Details on ACMS:ACMS stands for Atomic Controlfile Memory Service. GCS(Global Cache Service) that enable cache fusion.it is easy to get the block image from the insatnce which has the block in its SGA rather than reading from the disk. Give details on GTX0-j :The process provides transparent support for XA global transactions in a RAC environment.This is called as Global Enqueue Service Monitor.Oracle RAC instances are composed of following background processes: ACMS²Atomic Controlfile to Memory Service (ACMS) GTX0-j²Global Transaction Process LMON²Global Enqueue Service Monitor LMD²Global Enqueue Service Daemon LMS²Global Cache Service Process LCK0²Instance Enqueue Process RMSn²Oracle RAC Management Processes (RMSn) RSMN²Remote Slave Monitor What is GRD? GRD stands for Global Resource Directory.This process is referred to as cache fusion and helps in data integrity.

SPFIles. OCFS2 and OCFS(Oracle Cluster Fie systems). The interconnect network uses a switch/multiple switches that only the nodes in the cluster can access.This process manages non-cache fusion resource requests such as libry and row cache requests. Give details on RMSn:This process is called as Oracle RAC management process. redo log files must reside on cluster-aware shred storage. What components in RAC must reside in shared storage? All datafiles. crossover cables are not supported with Oracle Clusterware intercnects. Give few examples for solutions that support cluster storage:ASM(automatic storage management). controlfiles. Can we use crossover cables with Oracle Clusterware interconnects? No. This is a background slave process.These pocesses perform managability tasks for Oracle RAC.On unia and linux systems we use UDP and RDS(Reliable data socket) protocols to be used by Oracle Clusterware. Give details on LCK0:This process is called as Instance enqueue process. What is an interconnect network? an interconnect network is a private network that connects all of the servers in a cluster.This process also controls the flow of messages to remote instances and manages global data block access and transmits block images between the buffer caches of different instances.network file system(NFS).This process manages background slave process creation andd communication on remote instances.Dectory(GRD). What is the significance of using cluster-aware shared storage in an Oracle RAC environment? All instances of an Oracle RAC can access all the datafiles. SPFILE's. Give details on RSMN:This process is called as Remote Slave Monitor.Tasks include creation of resources related Oracle RAC when new instances are added to the cluster.This process performs tasks on behalf of a co-ordinating process running in another instance. redolog files when these files are hosted out of cluster-aware shared storage which are group of shared disks.raw disk devices.control files.Windows clusters use the TCP protocol. How can we configure the cluster interconnect? Configure User Datagram Protocol(UDP) on Gigabit ethernet for cluster interconnect. .This processing is a part of cache fusion feature.

What is the significance of VIP address failover? When a VIP address failover happens. Give situations under which VIP address failover happens:VIP addresses failover happens when the node on which the VIP address runs fails.with or without connection pooling. To configureVIP address. What is the use of VIP? If a node fails. What is the use of a service in Oracle RAC environemnt? Applications should use the services feature to connect to the Oracle database. What is a virtual IP address or VIP? A virtl IP address or VIP is an alternate IP address that the client connectins use instead of the standard public IP address. we need to reserve a spare IP address for each node. all interfaces for the VIP address fails. . and the IP addresses must use the same subnet as the public network. all interfaces for the VIP address are disconnected from the network. Clients that attempt to connect to the VIP address receive a rapid connection refused error . then the node's VIP address fails over to another node on which the VIP address can accept TCP connections but it cannot accept Oracle connections. Which enable the load balancing of applications in RAC? Oracle Net Services enable the load balancing of application connections across all of the instances in an Oracle RAC database. What are the characteriscs controlled by Oracle services feature? The charateristics include a unique name. How do users connect to database in an Oracle RAC environment? Users can access a RAC database using a client/server configuration or through one or more middle tiers .Services enable us to define rules and characteristics to control how users and applications connect to database instances. workload balancing and failover options.What is the use of cluster interconnect? Cluster interconnect is used by the Cache fusion for inter instance communication.and high availability characteristics.Users can use oracle services feature to connect to database.They don't have to wait for TCP connection timeout messages.

ASM does this by distributing the database file across all of the available storage within our cluster database environment.This is a notification mechanism that Oracle RAc uses to notify other processes about the configuration and service level information that includes service status changes such as.we can deinstall the Oracle database software independent of the ASM instance.services and nodes. State the use of FAN events in case of a cluster configuration change? During times of cluster configuration changes.UP or DOWN events.NETCA How do we verify that RAC instances are running? Issue the following query from any one node connecting through SQL*PLUS.What are the administrative tools used for Oracle RAC environments? Oracle RAC cluster can be administered as a single image using OEM(Enterprise Manager). The query gives the instance number under INST_NUMBER column. Why should we have seperate homes for ASm instance? It is a good practice to have ASM home seperate from the database hom(ORACLE_HOME).Applications can respond to FAN events and take immediate action.services and nodes.host_:instancename under INST_NAME column.clusterverificationutility(cvu).SQL*PLUS.This helps in upgrading and patching ASM and the Oracle database software independent of each other. What is the advantage of using ASM? Having ASM is the Oracle recommended storage option for RAC databases as the ASM maximizes performance by managing the storage configuration across the disks.This prevents applications from polling database and detecting a problem after such a state change.So applications can receive FAN events and react immediately. . What is FAN? Fast application Notification as it abbreviates to FAN relates to the events related to instances.Servercontrol(SRVCTL). $connect sys/sys as sysdba SQL>select * from V$ACTIVE_INSTANCES. Where can we apply FAN UP and DOWN events? FAN UP and FAN DOWN events can be applied to instances.Also.Oracle RAC high availability framework publishes a FAN event immediately when a state change occurs in the cluster.DBCA.

What two parameters must be set at the time of starting up an ASM instance in a RAC environment?The parameters CLUSTER_DATABASE and INSTANCE_TYPE must be set.The list of parameters that must be identical on every instance are given below: ACTIVE_INSTANCE_COUNT ARCHIVE_LAG_TARGET COMPATIBLE CLUSTER_DATABASE CLUSTER_DATABASE_INSTANCE CONTROL_FILES DB_BLOCK_SIZE DB_DOMAIN DB_FILES DB_NAME DB_RECOVERY_FILE_DEST DB_RECOVERY_FILE_DEST_SIZE DB_UNIQUE_NAME INSTANCE_TYPE (RDBMS or ASM) PARALLEL_MAX_SERVERS REMOTE_LOGIN_PASSWORD_FILE UNDO_MANAGEMENT Can the DML_LOCKS and RESULT_CACHE_MAX_SIZE be identical on all instances? These parameters can be identical on all instances only if these parameter values are set to zero. This enables us to patch or upgrade ASM nodes in a clustered environment without affecting database availability.a VIP address.an application process etc. What is a CRS resource? Oracle clusterware is used to manage high-availability operations in a cluster.a service.an instance. Can rolling upgrade be used to upgrade from 10g to 11g database? No.a listener.Their value must be specified in SPFILE or PFILE for every instance. Mention the components of Oracle clusterware:Oracle clusterware is made up of components like voting disk and Oracle Cluster Registry(OCR). What is the use of OCR? Oracle clusterware manages CRS resources based on the configuration information of CRS .ASM instances in Oracle database 11g release(from 11.What is rolling upgrade? It is a new ASM feature from Database 11g.Some examples of CRS resources are database.1).1) can be upgraded or patched using rolling upgrade feature.it can be used only for Oracle database 11g releases(from 11.Anything that Oracle Clusterware manages is known as a CRS resource. State the initialization parameters that must have same value for every instance in an Oracle RAC database:Some initialization parameters are critical at the database creation time and must have same values.During a rolling upgrade we can maintain a functional cluster while one or more of the nodes in the cluster are running in different software versions.

After that asm can be removed using srvctl tool as follows: srvctl stop asm -n node_name srvctl remove asm -n node_name We can verify if ASM has been removed by issuing the following command: srvctl config asm -n node_name How do we verify that an instance has been removed from OCR after deleting an instance? Issue the following srvctl command: srvctl config database -d database_name cd CRS_HOME/bin . In addition we have GV$ views called as global views that has an INST_ID column of numeric data type.resources stored in OCR(Oracle Cluster Registry).GV$ views obtain information from individual V$ views. . How does a Oracle Clusterware manage CRS resources? Oracle clusterware manages CRS resources based on the configuration information of CRS resources stored in OCR(Oracle Cluster Registry).Identify the interconnect being used CVU .Cluster verification utility to get status of CRS resources What are the modes of deleting instances from ORacle Real Application cluster Databases? We can delete instances using silent mode or interactive mode using DBCA(Database Configuration Assistant). Name some Oracle clusterware tools and their uses? OIFCFG .allocating and deallocating network interfaces OCRCONFIG ./crs_stat How do we verify an existing current backup of OCR? We can verify the current backup of OCR using the following command : ocrconfig showbackup What are the performance views in an Oracle RAC environment? We have v$ views that are instance specific.Command-line tool for managing Oracle Cluster Registry OCRDUMP . How do we remove ASM from a Oracle RAC environment? We need to stop and delete the instance in the node first in interactive or silent mode.

Runs on primary database.Redo Transport Services .Basic mechanism behind standby database configuration is the Redo Transport Services.In case of server-side load balancing listener uses a load-balancing advisory to redirect connections to the instance providing best service.orcl4" -o immediatesrvctl start database -d name [-o start_options]srvctl stop database -d name [-o stop_options]srvctl start database -d orcl -o mount Oracle Dataguard 11g . What is the differnece between server-side and client-side connection load balancing? Client-side balancing happens at client side where load balancing is done using listener.Some important processes are : 1) Log Network Server (LNS) . wherein redo data is shipped from Primary database to one or more standby databases. http://neworacledba. there are two types of redo transport services : 1) Synchronous Redo Transport (SYNC).What are the types of connection load-balancing? There are two types of connection load-balancing:server-side load balancing and client-side load balancing. 1) Whenever an user commits a transaction.html A comprehensive set of Oracle dataguard processes help in redo shipping. Give the usage of srvctl:srvctl start instance -d db_name -i "inst_name_list" [-o start_options]srvctl stop instance -d name -i "inst_name_list" [-o stop_options]srvctl stop instance -d orcl -i "orcl3.It uses the concept of primary database and one or more standby databases to provide high availability.This is the LNS counterpart at standby database site. It recevies the redo information sent by LNS and writes them to standby Redo Log File (SRL) Depending on method in which redo transport services work.com/2009/10/oracle-dataguard-11g-redo-transport_16.blogspot. Also known as zero data loss 2) Asynchronous redo transport (ASYNC) We'll be discussing about synchronous redo transport(SYNC)/zero data loss in detail in this post. . corresponding redo vectors are written from redo log buffer in SGA to online redo log file using the process LGWR (Log Writer). It reads the redo information directly from redo log buffer in SGA and ships it to standby databases with the help of Oracle Net Services 2) RFS (Remote File Server) .Synchronous Redo Transport (SYNC) Oracle dataguard 11g is the latest high availability solution from Oracle Corporation.

3) Remote File Server (RFS) process at the standby site receives the information sent by LNS from primary database site and writes them to standby redo log files (SRL).com/2009/10/oracle-asm-automatic-storage-manager_22.ASMCMD Copy Command From Oracle database 11g.ifr connect_string:source_filename connect_string:targetfilename .It is used to copy database files into and out of ASM diskgroups in local system or an remote system. Some unix commands are common to both linux and solaris whereas some commands differ. Both are operating systems upon which all the applications run.html Usage : cp .2) At the same time Log Network Server (LNS) reads the redo information from redo log buffer in SGA and ships it to standby sites with the help of Oracle Net Services. It is now being customized by many different companies like ORacle Corporation. Both Linux and Solaris are flavours of UNIX. Solaris is the form of unix customized by Sun Microsystems. Linux is a freeware and some vendors like fedora core offer linux whichcan be downloaded and installed for free.ASMCMD copy command can be used to transfer files.Red Hat. Solaris is licenced version from sun microsystems (can be fixed or floating licence).blogspot.Following files can be transferred using ASMCMD Copy Command : 1) Data files 2) archived redo log files 3) password file 4) Initialization parameter file http://neworacledba. Linux is an open source. Debian etc. There are many open source forms and groups that helps us information on linux. SuSe. Storage Manager) 11g . ASMCMD has COpy option included to it. Check the documentation of the vendor before installing linux to confirm the compatability of linux in the particular hardware. Sun has its own form of hardware called as sun servers which are used to host solaris. It doesn't require an active database instance. It is now acquired by Oracle Corporation.

In case of local system port number is 1521 Oracle Dataguard 11g . there are two types of redo transport services : 1) Synchronous Redo Transport (SYNC).Redo Transport Services . Not needed for local system.Runs on primary database. http://neworacledba. Prompt before copying or overwriting the file f . It recevies the redo information sent by LNS and writes them to standby Redo Log File (SRL) Depending on method in which redo transport services work.target directory connection_string .Interactive copy. It can be fully qualified filename(full path).target file name target_directory .Where options are. It reads the redo information directly from redo log buffer in SGA and ships it to standby databases with the help of Oracle Net Services 2) RFS (Remote File Server) . an ASM alias target_filename . i . Copies all subdirectories source_filename . It is of form host:port.com/2009/10/oracle-dataguard-11g-redo-transport_16. .Synchronous Redo Transport (SYNC) Oracle dataguard 11g is the latest high availability solution from Oracle Corporation. Same as normal copy command.Some important processes are : 1) Log Network Server (LNS) .Source file name. remove it and try again without user interaction r .html A comprehensive set of Oracle dataguard processes help in redo shipping.blogspot.connection string used in case of remote instance copy. Also known as zero data loss 2) Asynchronous redo transport (ASYNC) We'll be discussing about synchronous redo transport(SYNC)/zero data loss in detail in this post.Basic mechanism behind standby database configuration is the Redo Transport Services.recursive copy. wherein redo data is shipped from Primary database to one or more standby databases.This is the LNS counterpart at standby database site.If the destination file already exists.It uses the concept of primary database and one or more standby databases to provide high availability.

3) Remote File Server (RFS) process at the standby site receives the information sent by LNS from primary database site and writes them to standby redo log files (SRL). 2) At the same time Log Network Server (LNS) reads the redo information from redo log buffer in SGA and ships it to standby sites with the help of Oracle Net Services.com/2009/10/oracle-dataguard-11g-redo-transport_16.html .blogspot. For full story read : http://neworacledba.1) Whenever an user commits a transaction. corresponding redo vectors are written from redo log buffer in SGA to online redo log file using the process LGWR (Log Writer).

Sign up to vote on this title
UsefulNot useful