This action might not be possible to undo. Are you sure you want to continue?
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:
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
When you create a user. You give each column a column name. such as employee_id. What Is a User Role? A user role is a group of privileges. grant privileges to the roles. last_name. triggers. A row is a collection of column information corresponding to a single record. Each user owns a single schema. and other types of data objects. and so on) that the user creates. What Is a Database Table? A database table is a basic unit of data logical storage in an Oracle database. You create new roles. and then grant roles to users. views. Privileges are assigned to users through user roles. Data is stored in rows and columns. The schema name is the same as the user name. . or schema objects.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. define precision and scale instead of width. A schema is owned by a database user and has the same name as that user. 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 a set of columns. such as VARCHAR2. a datatype. and can be used to unambiguously refer to objects owned by the user. Schema objects can be created and manipulated with SQL and include: tables. The width can be predetermined by the datatype. A schema is a logical container for the database objects (such as tables. What is a Database Schema? A schema is a collection of logical structures of data. DATE. and a width. such as employees. and job_id. you are also implicitly creating a schema for that user. If columns are of the NUMBER datatype. views. as in DATE. You define a table with a table name. or NUMBER.
Tables in recycle bin can be recovered back into database by the Flashback Drop action. A DBA_ view displays all relevant information in the entire database. or "V$" views. Many data dictionary tables have three corresponding views: y y y An ALL_ view displays all the information accessible to the current user. in case it was dropped in error. They can be accessed only by users with the SELECT ANY TABLE privilege. Oracle database recycle save the same purpose as the recycle bin on your Windows desktop. These views are called dynamic performance views because they are continuously updated while a database is open and in use. including information from the current user's schema as well as information from objects in other schemas. No special privileges are required to query these views. A database can contain multiple tablespaces.You can select from these views. To list the data dictionary views available to you. What Is an Oracle Data File? An Oracle data file is a big unit of physical storage in the OS file system.multiple application objects can be stored in one tablespace. and their contents relate primarily to performance. but you can access information in them through data dictionary views. are useful for identifying instance-level performance problems. What Is a Dynamic Performance View? Dynamic performance views. This privilege is assigned to the DBA role when the system is initially installed. A USER_ view displays all the information from the schema of the current user. if the current user has access to those objects by way of grants of privileges or roles.What Is an Oracle Tablespace? A tablespace is a logical storage unit . query the view DICTIONARY. Each tablespace in an Oracle database consists of one or more files called datafiles. DBA_ views are intended only for administrators. What Is a Recycle Bin? Recycle bin is a logical storage to hold the tables that have been dropped from the database. All V$ views are listed in the V$FIXED_TABLE view. One or many Oracle data files are organized together to provide physical storage to a single Oracle tablespace. but you can never update or alter them. 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. Open Database Communication. 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. One or many Oracle data files are organized together to provide physical storage to a single Oracle tablespace. each consisting of two datafiles (for a total of six datafiles). Another database can have three tablespaces. the simplest Oracle database would have one tablespace and one datafile. How a Database Is Related to Tablespaces? A database's data is collectively stored in the datafiles that constitute each tablespace of the database. . What Is Open Database Communication (ODBC)? ODBC. is a foundation technology. TABLESPACE AND DATAFILE What Is an Oracle Tablespace? An Oracle tablespace is a big unit of logical storage in an Oracle database. How a Tablespace Is Related to Data Files? Each tablespace in an Oracle database consists of one or more files called datafiles. Oracle offers ODBC drivers to allow Windows applications to connect Oracle server through ODBC.Recycle bin can be turned on or off in the recyclebin=on/off in your parametere file. It is managed and used by the Oracle server to store structures data objects. which are physical structures that conform to the operating system in which Oracle is running. It has a command-line user interface. built into the Oracle Net foundation layer that works with any standard network transport protocol. Transport Network Substrate. a standard API (application program interface) developed by Microsoft for Windows applications to communicate with database management systems. like tables and indexes. For example. a Windows Graphical User Interface (GUI) and the iSQL*Plus web-based user interface.
which Oracle creates automatically when the database is created. In automatic undo management mode. TABLESPACE_NAME STATUS CONTENTS -----------------------------. A locally managed SYSTEM tablespace cannot be used for default temporary storage. you can use the DBA_TABLESPACES view as shown in the following SQL script example: SQL> connect SYSTEM/fyicenter Connected. SQL> col file_name format a36.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. 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. each Oracle instance is assigned one (and only one) undo tablespace. Oracle server will create 4 required tablespaces for the new database: y y y y SYSTEM Tablespace .The SYSAUX tablespace was installed as an auxiliary tablespace to the SYSTEM tablespace when you created your database. BYTES .When the SYSTEM tablespace is locally managed. SQL> SELECT TABLESPACE_NAME. TEMP Tablespace . SQL> SELECT TABLESPACE_NAME.--------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. you must define at least one default temporary tablespace when creating a database. The SYSTEM tablespace is always online when the database is open. Each database contains zero or more undo tablespaces. UNDO Tablespace . STATUS. Undo data is managed within an undo tablespace using undo segments that are automatically created and maintained by Oracle.--------. FILE_NAME. Some database components that formerly created and used separate tablespaces now occupy the SYSAUX tablespace.UNDO tablespaces are special tablespaces used solely for storing undo information. SYSAUX Tablespace . you can use the DBA_TABLESPACES view as shown in the following SQL script example: SQL> connect SYSTEM/fyicenter Connected. You cannot create any other segment types (for example. CONTENTS 2 FROM USER_TABLESPACES.Every Oracle database contains a tablespace named SYSTEM. SQL> col tablespace_name format a16. tables or indexes) in undo tablespaces.
dbf' SIZE 10M. FILE_NAME. you can use the CREATE TABLESPACE .DBF MY_SPACE \TEMP\MY_SPACE.2 FROM DBA_DATA_FILES. RENAME TO statement as shown in the example below: . like tablespace and database.DBF UNDO \ORACLEXE\ORADATA\XE\UNDO. BYTES 2 FROM DBA_DATA_FILES. The data file size is about 10MB.DBF SYSAUX \ORACLEXE\ORADATA\XE\SYSAUX. TABLESPACE_NAME FILE_NAME --------------. How To Rename a Tablespace? You can easily rename a tablespace by using the ALTER TABLESPACE .-------------------------------USERS \ORACLEXE\ORADATA\XE\USERS. Tablespace created. TABLESPACE_NAME STATUS CONTENTS ---------------.DBF SYSAUX \ORACLEXE\ORADATA\XE\SYSAUX. DATAFILE statement as shown in the following script: SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. How To Create a New Tablespace? If you want a new dataspace.------------------------------USERS \ORACLEXE\ORADATA\XE\USERS...DBF SYSTEM \ORACLEXE\ORADATA\XE\SYSTEM. you will see the data file is located in the \temp directory of. STATUS. Data files are created as part of statements that manages other data structures. CONTENTS 2 FROM USER_TABLESPACES.DBF UNDO \ORACLEXE\ORADATA\XE\UNDO.DBF SYSTEM \ORACLEXE\ORADATA\XE\SYSTEM.--------------.DBF BYTES --------104857600 461373440 94371840 356515840 10485760 So one statement created two structures: a tablespace and a data file. TABLESPACE_NAME FILE_NAME --------------... If you check your file system with Windows file explorer. Its contents should be blank and full of \x00 at this time. SQL> SELECT TABLESPACE_NAME.--------SYSTEM ONLINE PERMANENT UNDO ONLINE UNDO SYSAUX ONLINE PERMANENT TEMP ONLINE TEMPORARY USERS ONLINE PERMANENT MY_SPACE ONLINE PERMANENT SQL> SELECT TABLESPACE_NAME.DBF BYTES --------104857600 461373440 94371840 356515840 How To Create a new Oracle Data File? There is no dedicated statement to create a data file.
if they are no longer needed.--------------. Tablespace dropped. what happens to its data files? By default.dbf' SIZE 10M. SQL> SELECT TABLESPACE_NAME. 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. STATUS. How To Create a Table in a Specific Tablespace? . TABLESPACE_NAME STATUS CONTENTS ---------------.dbf' SIZE 10M. SQL> DROP TABLESPACE my_space. Tablespace dropped. SQL> DROP TABLESPACE my_space INCLUDING CONTENTS 2 AND DATAFILES. Tablespace created. Tablespace created. CONTENTS 2 FROM USER_TABLESPACES. data files will remain in OS file system. Of course. you delete the data files using OS commands. SQL> ALTER TABLESPACE my_space RENAME TO your_space.--------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. Another way of deleting data files is to use the INCLUDING clause in the DROP TABLESPACE statement. Tablespace created. even if the tablespace they are mapped is dropped. 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.dbf' SIZE 10M. What Happens to the Data Files If a Tablespace Is Dropped? If a tablespace is dropped.
Here is a sample script: SQL> connect SYSTEM/fyicenter Connected. TABLE_NAME -----------------------------MY_TEAM EMPLOYEES . a contiguous area of space. num_rows 2 FROM USER_TABLES 3 WHERE tablespace_name in ('USERS'. SQL> connect HR/fyicenter Connected. Tablespace created. TABLESPACE_NAME FILE_ID BYTES -----------------------------. you need to use the TABLESPACE clause in the CREATE TABLE statement. BYTES 2 FROM USER_FREE_SPACE 3 WHERE TABLESPAE_NAME IN ('USERS'.---------. Here is SQL script example on how to see free space of a tablespace: SQL> connect HR/fyicenter Connected. SQL> CREATE TABLE my_team TABLESPACE my_space 2 AS SELECT * FROM employees.---------MY_SPACE 5 10354688 USERS 4 101974016 USERS 4 65536 USERS 4 65536 USERS 4 65536 USERS 4 65536 USERS 4 65536 . FILE_ID. tablespace_name. TABLESPACE_NAME NUM_ROWS ---------------.. 'MY_SPACE'). To create a table in a specific tablespace. you can give it to your users for them to create tables in the new tablespace. Free space information can be monitored through the USER_FREE_SPACE view.---------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. of free space in a data file of a tablespace. 'MY_SPACE'). SQL> SELECT TABLESPACE_NAME.dbf' SIZE 10M. Table created. SQL> SELECT table_name..After you have created a new tablespace. Each record in USER_FREE_SPACE represents an extent. 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.. SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. OFFLINE statement as shown in the following script: SQL> connect HR/fyicenter Connected. SQL> ALTER TABLESPACE my_space ONLINE. Tablespace altered. now you want to make it available to users again..dbf' SIZE 10M. Tablespace created.. How To Bring a Tablespace Online? If you have brought a tablespace offline. Tablespace altered. USERS has one big free extent of 100MB.. and many small free extents of 64KB. you can use the ALTER TABLESPACE . How To Bring a Tablespace Offline? If you want to stop users using a tablespace. SQL> ALTER TABLESPACE my_space OFFLINE NORMAL. you can bring it offline using the ALTER TABLESPACE . SQL> ALTER TABLESPACE my_space OFFLINE NORMAL. Tablespace created. ONLINE statement as shown in the following script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. .. How To Add Another Datafile to a Tablespace? ..dbf' SIZE 10M. Tablespace altered.
DBF BYTES --------104857600 461373440 94371840 356515840 10485760 5242880 SQL> SELECT TABLESPACE_NAME.dbf' SIZE 5M. TABLESPACE_NAME FILE_ID BYTES -----------------------------..---------MY_SPACE 6 5177344 MY_SPACE 5 10354688 This script created one tablespace with two data files.. See the following sample script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space.DBF MY_SPACE C:\TEMP\MY_SPACE_2. Tablespace altered.If you created a tablespace with a data file a month ago. Oracle can still start the database instance and mount the database.dbf' SIZE 10M. you should add another data file to the tablespace. Tablespace created. If you try to start the database again you will get error when Oracle tries to open the database after mounting the database. now 80% of the data file is used.DBF SYSTEM C:\ORACLEXE\ORADATA\XE\SYSTEM. ADD DATAFILE statement. you accidently deleted a data file from the operating system. BYTES 2 FROM DBA_DATA_FILES.--------------------------------USERS C:\ORACLEXE\ORADATA\XE\USERS. SQL> ALTER TABLESPACE my_space 2 DATAFILE '/temp/my_space_2. This can be done by using the ALTER TABLESPACE . Total System Global Area Fixed Size 100663296 bytes 1285956 bytes . What Happens If You Lost a Data File? After you shuting down an Oracle database. TABLESPACE_NAME FILE_NAME --------------.DBF MY_SPACE C:\TEMP\MY_SPACE.dbf is deleted. The following tutorial examples shows you what will happen if the data file c:\temp\my_space. BYTES 2 FROM USER_FREE_SPACE 3 WHERE TABLESPAE_NAME IN ('MY_SPACE').---------. 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.DBF SYSAUX C:\ORACLEXE\ORADATA\XE\SYSAUX. FILE_NAME. FILE_ID. SQL> SELECT TABLESPACE_NAME.DBF UNDO C:\ORACLEXE\ORADATA\XE\UNDO.
DBF 503316480 C:\ORACLEXE\ORADATA\XE\UNDO. What you can do is to set the bad data file as offline befor opening the database. ORA-01157: cannot identify/lock data file 5 . ORA-01109: database not open Database dismounted. FILE_NAME. How Remove Data Files befor opening a Database? Let's say you have a corrupted data file or lost a data file.DBF 104857600 C:\ORACLEXE\ORADATA\XE\SYSAUX. col tablespace_name format a16. ORACLE instance started. SELECT TABLESPACE_NAME.--------C:\ORACLEXE\ORADATA\XE\USERS. 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.Variable Size 58720444 bytes Database Buffers 37748736 bytes Redo Buffers 2908160 bytes Database mounted. Database altered. FILE_NAME BYTES --------------------------------. Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers Database mounted. SQL> ALTER DATABASE DATAFILE '\temp\my_space_2. Oracle can mount the database. SQL> SQL> SQL> 2 col file_name format a36. But it will not open the database.DBF 94371840 TABLESPACE_NAME --------------USERS SYSAUX UNDO . SQL> ALTER DATABASE OPEN.see DBWR trace file ORA-01110: data file 5: 'C:\TEMP\MY_SPACE.dbf' 2 OFFLINE DROP. Database altered. BYTES FROM DBA_DATA_FILES.dbf' 2 OFFLINE DROP. 100663296 1285956 58720444 37748736 2908160 bytes bytes bytes bytes bytes SQL> ALTER DATABASE DATAFILE '\temp\my_space.DBF' SQL> SHUTDOWN. ORACLE instance shut down. Database altered.
ONLINE statement as shown in the following script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space. FILE_ID. Tablespace created. See the following sample script: SQL> connect HR/fyicenter SQL> CREATE TABLESPACE my_space 2 DATAFILE '/temp/my_space.. SQL> SELECT TABLESPACE_NAME. SQL> ALTER TABLESPACE my_space ONLINE.. . now 80% of the data file is used.DBF C:\TEMP\MY_SPACE_2. you can use the ALTER TABLESPACE . FILE_NAME. This can be done by using the ALTER TABLESPACE .DBF MY_SPACE C:\TEMP\MY_SPACE.--------------------------------USERS C:\ORACLEXE\ORADATA\XE\USERS.. Tablespace created.dbf' SIZE 10M. SQL> ALTER TABLESPACE my_space 2 DATAFILE '/temp/my_space_2. Tablespace altered.dbf' SIZE 5M.DBF How To Bring a Tablespace Online? If you have brought a tablespace offline.DBF SQL> SELECT TABLESPACE_NAME. TABLESPACE_NAME FILE_NAME --------------.dbf' SIZE 10M.DBF MY_SPACE C:\TEMP\MY_SPACE_2. Tablespace altered..DBF 367001600 C:\TEMP\MY_SPACE. SQL> ALTER TABLESPACE my_space OFFLINE NORMAL. ADD DATAFILE statement... now you want to make it available to users again. How To Add Another Datafile to a Tablespace? If you created a tablespace with a data file a month ago.DBF SYSAUX C:\ORACLEXE\ORADATA\XE\SYSAUX. Tablespace altered. BYTES 2 FROM DBA_DATA_FILES.DBF SYSTEM C:\ORACLEXE\ORADATA\XE\SYSTEM.DBF UNDO C:\ORACLEXE\ORADATA\XE\UNDO.SYSTEM MY_SPACE MY_SPACE C:\ORACLEXE\ORADATA\XE\SYSTEM. BYTES 2 FROM USER_FREE_SPACE BYTES --------104857600 461373440 94371840 356515840 10485760 5242880 . you should add another data file to the tablespace.
ORA-01157: cannot identify/lock data file 5 .see DBWR trace file ORA-01110: data file 5: 'C:\TEMP\MY_SPACE. Oracle can mount the database. ORACLE instance started. ORA-01109: database not open Database dismounted. TABLESPACE_NAME FILE_ID BYTES -----------------------------. Total System Global Area 100663296 bytes Fixed Size 1285956 bytes Variable Size 58720444 bytes Database Buffers 37748736 bytes Redo Buffers 2908160 bytes Database mounted. 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. What Happens If You Lost a Data File? After you shuting down an Oracle database.3 WHERE TABLESPAE_NAME IN ('MY_SPACE'). Oracle can still start the database instance and mount the database. What you can do is to set the bad data file as offline befor opening the database.DBF' SQL> SHUTDOWN. ORACLE instance shut down. 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.dbf is deleted. But it will not open the database. . 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. The following tutorial examples shows you what will happen if the data file c:\temp\my_space. How Remove Data Files befor opening a Database? Let's say you have a corrupted data file or lost a data file. If you try to start the database again you will get error when Oracle tries to open the database after mounting the database.---------.
DBF C:\TEMP\MY_SPACE. SQL> ALTER DATABASE DATAFILE '\temp\my_space_2.DBF C:\TEMP\MY_SPACE_2.dbf' 2 OFFLINE DROP. BYTES FROM DBA_DATA_FILES. SQL> SQL> SQL> 2 col file_name format a36. SELECT TABLESPACE_NAME.\bin\startdb >. FILE_NAME. 10g XE will create a special Windows user group called ORA_DBA. Database altered.DBF C:\ORACLEXE\ORADATA\XE\UNDO.Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers Database mounted.DBF C:\ORACLEXE\ORADATA\XE\SYSAUX. 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) >. Database altered. SQL> quit So if "connect" is used without user name and password. . SQL> ALTER DATABASE OPEN. 100663296 1285956 58720444 37748736 2908160 bytes bytes bytes bytes bytes SQL> ALTER DATABASE DATAFILE '\temp\my_space. the current Windows user will be trusted if he/she is in the ORA_DBA user group on the Windows system. and put your Windows user into this group.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. Any Windows users in this group can be connected to Oracle server with SYSDBA privilege without any Oracle server user account.DBF C:\ORACLEXE\ORADATA\XE\SYSTEM.\bin\sqlplus /nolog SQL> connect / AS SYSDBA Connected. col tablespace_name format a16. This process is called connecting the server as SYSDBA with OS Authentication. Database altered.dbf' 2 OFFLINE DROP. FILE_NAME --------------------------------C:\ORACLEXE\ORADATA\XE\USERS.
--------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. How To Change User Password? If you want to change a user's password. You can test this account by log in with DEV from SQL*Plus. Try the following script: >.". SQL> CREATE USER DEV IDENTIFIED BY developer ACCOUNT UNLOCK. so you need to terminate it with ". A simple SELECT statement can be used to get a list of all user accounts.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter Connected. User created. you can log in as SYSTEM and use the CREATE USER command as shown in the following example: >.---------. This command creates a user called "DEV". you can log in as SYSTEM and use the ALTER USER command as shown in the following example: >. Note that CREATE is a SQL statement.How To List All User Accounts? User accounts can be accessed through a system view called ALL_USERS. with a password of "developer". USERNAME USER_ID CREATED -----------------------------.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter Connected.\bin\sqlplus /nolog . SQL> SELECT * FROM ALL_USERS.
you will find out how Oracle denies connection: >.\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. SQL> ALTER USER DEV IDENTIFIED BY beginner. The following tutorial exercise shows you how to grant DEV the privilege to connect to the server: .". User dropped. What Privilege Is Needed for a User to Connect to Oracle Server? Oracle deny connection to users who has no CREATE SESSION privilege. logon denied Oracle error message is pretty clear. Note that ALTER is SQL statement. Try the following tutorial exercise. you can use the GRANT command. This command resets DEV's password to "beginner".\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter Connected. User altered. User created. How To Grant CREATE SESSION Privilege to a User? If you want give a user the CREATE SESSION privilege. SQL> disconnect SQL> CONNECT DEV/developer ORA-01045: user DEV lacks CREATE SESSION privilege. you can log in as SYSTEM and use the DROP USER command as shown in the following example: >. How To Delete a User Account? If you want to delete a user account and its associated schema. User created. so you need to terminate it with ".SQL> connect SYSTEM/fyicenter Connected. SQL> DROP USER DEV CASCADE. Note that CASCADE tells the server drop the associated schema.
Revoke succeeded.>. User altered. so you can continue other example scripts below. and unlock it later. SQL> GRANT CREATE SESSION TO dev. you can use the REVOKE command as shown in the following example script: >. Grant succeeded. This script restored the CREATE SESSION privilege to user "dev". ACCOUNT command. SQL> disconnect SQL> CONNECT DEV/developer Connected. Grant succeeded.. How To Revoke CREATE SESSION Privilege from a User? If you take away the CREATE SESSION privilege from a user. User altered. SQL> disconnect SQL> CONNECT DEV/developer ORA-28000: the account is locked SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> ALTER USER dev ACCOUNT UNLOCK.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> REVOKE CREATE SESSION FROM dev. The following sample script shows how to use this command: >..\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> ALTER USER dev ACCOUNT LOCK. SQL> disconnect SQL> CONNECT DEV/developer Connected. you can use the ALTER USER . . How To Lock and Unlock a User Account? If you want to lock a user account for a short period of time.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> GRANT CREATE SESSION TO dev.
Table dropped. Oracle will assign the SYSTEM tablespace to the user by default. Table created. If you want to change this. SQL> DROP TABLE fyi. .What Privilege Is Needed for a User to Create Tables? To be able to create tables in a user's own schema.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> ALTER USER dev DEFAULT TABLESPACE USERS. ORA-01950: no privileges on tablespace 'SYSTEM' The above error message tells that user "dev" is not allowed to use the tablespace "SYSTEM". Grant succeeded. The following tutorial exercise changes user dev's default tablespace. and allows the user to create tables in other user's schema. SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE TABLE fyi (id NUMBER). User altered. you can assign a different table space to a user using the ALTER USER command. which is more powerful. The following tutorial exercise gives you a good example on CREATE TABLE privilege: >. SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE TABLE fyi (id NUMBER). and assigns 4MB of space to dev: >. SQL> ALTER USER dev QUOTA 4M ON USERS. How To Assign a Tablespace to a Users? When you create a new user. See the next question for answers. or the CREATE ANY TABLE privilege. the user needs to have the CREATE TABLE privilege.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> CREATE TABLE fyi (id NUMBER). ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT CREATE TABLE TO dev. User altered.
What Privilege Is Needed for a User to Create Indexes? For a user to create indexes.\bin\sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> GRANT CREATE TABLE TO dev. he/she needs the same privilege as the creating tables. 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. or the CREATE ANY VIEW privilege. SQL> CREATE VIEW fyi_view AS SELECT * FROM fyi. View created. The following tutorial exercise gives you a good example on CREATE VIEW privilege: >. Grant succeeded. Grant succeeded. View dropped.SQL> CREATE TABLE fyi (id NUMBER). Just make sure he/she has the CREATE TABLE privilege. . As you can see. SQL> DROP VIEW fyi_view. The following tutorial exercise gives you a good example on creating view privilege: >. Table created.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> CREATE VIEW fyi_view AS SELECT * FROM fyi. and allows the user to create views in other user's schema. As you can see. "dev" can create and drop views now. SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE VIEW fyi_view AS SELECT * FROM fyi. "dev" can create and drop tables now. the user needs to have the CREATE VIEW privilege. You can also let "dev" to create tables in any tablespace without any restriction by granting him the UNLIMITED TABLESPACE system privilege. View created. which is more powerful.
SQL> disconnect SQL> CONNECT DEV/developer SQL> CREATE INDEX fyi_index ON fyi(id).employees. "dev" can query tables in any schema now.\bin\sqlplus /nolog . Index dropped. COUNT(*) ---------107 As you can see. You also need to remember that table name must be prefixed with the schema name (same as owner user name). This exercise assumes that you followed previous exercises in the FAQ collection. 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.employees. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT SELECT ANY TABLE TO dev. he/she needs the SELECT ANY TABLE privilege. SQL> disconnect SQL> CONNECT DEV/developer SQL> SELECT COUNT(*) FROM hr. SQL> CREATE INDEX fyi_index ON fyi(id). he/she needs the INSERT ANY TABLE privilege. SQL> DROP INDEX fyi_index.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> SELECT COUNT(*) FROM hr. Index created. Grant succeeded. 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. Index created. The following tutorial exercise gives you a good example of granting "dev" to insert rows in "hr" schema: >. The following tutorial exercise gives you a good example of granting "dev" to query tables in "hr" schema: >.
7700. 'Dev FYI Consultant'. Grant succeeded. But you should be careful when giving this privilege to a regular developer. SQL> disconnect SQL> CONNECT DEV/developer SQL> INSERT INTO hr. 8800). 'Dev FYI Consultant'. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT INSERT ANY TABLE TO dev.\bin\sqlplus /nolog SQL> CONNECT DEV/developer SQL> DELETE FROM hr.FYI'. 7700.jobs WHERE job_id = 'DV.FYI'. SQL> disconnect SQL> CONNECT DEV/developer SQL> DELETE FROM hr. "dev" can delete rows in any schema now. As you can see.FYI'. Grant succeeded. "dev" can insert rows in any schema now. How To Find Out What Privileges a User Currently Has? .jobs VALUES ('DV. 8800).FYI'. But you should be careful when giving this privilege to a regular developer. 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. 1 row deleted. 1 row created.SQL> CONNECT DEV/developer SQL> INSERT INTO hr. he/she needs the DELETE ANY TABLE privilege. ORA-01031: insufficient privileges SQL> disconnect SQL> connect SYSTEM/fyicenter SQL> GRANT DELETE ANY TABLE TO dev. As you can see. The following tutorial exercise gives you a good example of granting "dev" to delete rows in "hr" schema: >.jobs WHERE job_id = 'DV.jobs VALUES ('DV.
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:
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:
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.
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:
>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.
ora.ora ORACLE instance started. . and there is a bad parameter in the XE instance SPFile. How To Start Instance with a Minimal Initialization Parameter File? The sample initialization parameter file provided by Oracle seems to be not working.dbf") undo_management=AUTO Then start the FYI instance again: SQL> CONNECT / AS SYSDBA Connected. SQL> STARTUP NOMOUNT PFILE=$ORACLE_HOME/database/initFYI_ini_min. 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: >. But we can try to start the new instance with a minimal initialization parameter file (PFile). First you can create another PFile.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. But the initialization parameter file created in Step 3 has some problem with the log directory.SQL> STARTUP NOMOUNT ORA-00821: Specified value of sga_target 16M is too small. See the next FAQ question to find another way to start the new instance FYI. The STARTUP NOMOUNT command failed because it tried to start the default instance XE. needs to be at least 20M The SHUTDOWN command is need to bring the default instance XE down. $ORACLE_HOME/database/initFYI_ini_min.\bin\sqlplus /nolog SQL> CONNECT / AS SYSDBA Connected. as shown below: db_name=FYI control_files=("\oraclexe\oradata\FYI\control. SQL> STARTUP NOMOUNT PFILE=$ORACLE_HOME/database/initFYI_ini.
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.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. .dbf' SIZE 32M REUSE EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/oraclexe/oradata/FYI/sysaux01.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.dbf'SIZE 20M REUSE UNDO TABLESPACE undotbs DATAFILE '/oraclexe/oradata/FYI/undotbs01. unable to create file OSD-04002: unable to open file O/S-Error: (OS 3) The system cannot find the path specified. GROUP 3 ('/oraclexe/oradata/FYI/redo03. Here is how to run this long CREATE DATABASE statement: SQL> @$ORACLE_HOME\config\scripts\create_database_fyi.sql. $ORACLE_HOME/configscripts/create_database_fyi. GROUP 2 ('/oraclexe/oradata/FYI/redo02.log') SIZE 10M. Don't worry about the error messages. You can modify and same it in a file.dbf' SIZE 32M REUSE DEFAULT TABLESPACE tbs_1 DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/oraclexe/oradata/FYI/temp01.log') SIZE 10M. Oracle Administrator Guide provided a sample CREATE DATABASE statement. 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.sql. But it is a long statement. and run the file within SQL*Plus. They are caused by the missing directory for data files in file system.dbf' SIZE 20M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED.DBF' ORA-27040: file create error.
you can run the CREATE DATABASE statement again as shown below: SQL> @$ORACLE_HOME\config\scripts\create_database_fyi.sql SQL> @/u01/oracle/rdbms/admin/catproc. This can be done by using Windows file explorer to create the \oraclexe\oradata\fyi\ directory.dbf' SIZE 10M. SQL> CREATE TABLESPACE indx 2 DATAFILE '/oraclexe/oradata/FYI/indx01. The Oracle Administrator Guide suggests to run two SQL scripts provided by Oracle as shown bellow: SQL> @/u01/oracle/rdbms/admin/catalog. creating another database instance might be not allowed. Try the CREATE DATABASE statement again. 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. Here is a list of suggestions for you: y y y Run SHUTDOWN command to stop the partial started database instance. when you have the directory ready. How To Create Additional Tablespaces for an New Database? This is Step 8.sql. If your CREATE DATABASE statement failed half way again. How To Build Data Dictionary View an New Database? This is Step 9. How To Run CREATE DATABASE Statement Again? After cleaning up the results of a previously failed CREATE DATABASE statement.dbf' SIZE 10M. This time it might related the limitation that Oracle 10g XE only supports one database instance. you may have to clean up the partial result of the CREATE DATABASE statement.sql . Disconnection forced Something went wrong again. 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. With the default instance called "XE" already defined.How To Do Clean Up If CREATE DATABASE Failed? To better organize data files. CREATE DATABASE FYI * ERROR at line 1: ORA-01092: ORACLE instance terminated.
. SQL> SPOOL \oraclexe\test\employees. SQL*Plus allows you: y y y y Format. store.. you can concatenate your fields with an expression in the SELECT clause as shown in the tutorial exercise bellow: SQL> SET HEADING OFF. 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> SPOOL OFF. . Perform database administration. and print from query results.'|| url ||'.. The following tutorial exercise shows you how control the output format.txt with fixed length fields. 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. start the spooler.' delimited fields as shown here: .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. SQL> SELECT * FROM EMPLOYEES.. . If you want export data with variable field lengths and field delimiters.txt.txt with '. It is an Oracle database client tool that works as a command-line user interface to the database server..'|| notes ||'. Examine table and object definitions. You should see all records in fyi_links. How To Export Data with a Field Delimiter? The previous exercise allows you to export data with fixed field lengths. SQL> SPOOL \oraclexe\test\fyi_links.txt. SQL> SELECT id ||'. It allows you to record SELECT query result to a text file on the operating system. Develop and run batch scripts. SQL> SET LINESIZE 1000. SQL> SET LINESIZE 1000. SQL> SPOOL OFF.. SQL> SET FEEDBACK OFF. You should get all records in employees..'|| created FROM fyi_links. SQL> SET FEEDBACK OFF..'|| counts ||'.
13-JAN-83. There is an input data file stored at \oraclexe\text\student.123..4567 5. Can specify character set of the data. How To Load Data with SQL*Loader? Let's say you have a table defined as: CREATE TABLE student (id NUMBER(5) PRIMARY KEY.Daniel.25-JUN-87.124. bypassing normal record inserting process.4568 6. It allows you to specify: y y y y y y Where is the input data file.123.Valli.De Haan.Kochhar.4567 2.com.423.515.423. Can load data directly to Oracle datafiles.17-MAY-06 110. The format of the input date file.Diana.17-AUG-84.Nancy.Hunold.Ernst.Lorentz. Where to output errors. Can generate sophisticated error reports. The target table where the data should be loaded.16-AUG-84. last_name VARCHAR(80) NOT NULL. social_number VARCHAR(80) UNIQUE NOT NULL).5567 9.4169 .Session 1.590.515.515.4560 8..515.Alexander.07-FEB-89.21-MAY-81.Neena.Lex. first_name VARCHAR(80) NOT NULL.21-SEP-79.4569 10.Greenberg.Bruce.123. 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.txt with the following records: 1. birth_date DATE NOT NULL.590.124.Session 1.423.Steven.Pataballa.Austin. SQL*Loader is available as part of the free Oracle 10g Expression Edition.590.4569 4.4568 3.David.423. Select criteria to select input records for loading.101. How input data fields should be mapped to target table columns.4569 7.fyicenter.Faviet.590. 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.515.centerfyi.King.05-FEB-88.com.17-MAY-06 What Is SQL*Loader? SQL*Loader is a database tool that allows to load data from external files into database tables.03-JAN-80.17-JUN-77.423.
1.. data=\oraclexe\test\student. External tables can be used to load data from external files into database. or unload data from database to external files. you can run the SQL*Loader with the "sqlldr" command: >cd \oraclexe\app\oracle\product\10. . What Are the Restrictions on External Table Columns? When creating external table columns. How To Load Data through External Tables? If you have data stored in external files. birth_date. "DEFAULT value" is not allowed.log SQL*Loader: Release 10. social_number) When you are ready to load data.. "NOT NULL" is not allowed. you need to watch out some restrictions: y y y "PRIMARY KEY" is not allowed.2. Accessing data of external tables are done through data access drivers.txt.0. What Is an External Table? An external table is a table defined in the database with data stored outside the database.' (id. SELECT statement to load data from the external file to the regular table through the external table. Create a regular table with the same columns. Oracle supports two data access drivers: ORACLE_LOADER and ORACLE_DATAPUMP. Data of an external table is stored in files on the operating systems.logical record count 10 To see details of the loading process.log.ctl as: LOAD DATA APPEND INTO TABLE STUDENT FIELDS TERMINATED BY '.0 Commit point reached . 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.You can create a control file at \oraclexe\test\student. control=\oraclexe\test\student. you should check the log file \oraclexe\test\student. Run an INSERT INTO .0\server\BIN >sqlldr userid=hr/fyicenter. first_name. last_name.ctl.2. log=\oraclexe\test\student.
But you need to use ORGANIZATION EXTERNAL clause to specify the external file location and the data access driver.---------------------.What Is a Directory Object? A directory object is a logical alias for a physical directory path name on the operating system. The following tutorial exercise shows you some good examples: >sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> CREATE DIRECTORY test_dir AS '/oraclexe/test'. and granted access permissions to different users. SQL> DROP DIRECTORY temp_dir. Table created. TABLE_NAME TABLESPACE_NAME NUM_ROWS --------------------. created DATE ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY test_dir LOCATION ('ext_fyi_links. dropped. tablespace_name. Directory created. SQL> SELECT table_name.---------- . How To Define an External Table with a Text File? You can use the CREATE TABLE statement to create external tables. Grant succeeded. counts NUMBER(4). SQL> CREATE DIRECTORY temp_dir AS '/oraclexe/temp'. notes VARCHAR2(16). Directory objects can be created.txt') ). Grant succeeded. SQL> GRANT WRITE ON DIRECTORY test_dir TO hr. url VARCHAR2(16). Directory dropped. num_rows FROM USER_TABLES. SQL> GRANT READ ON DIRECTORY test_dir TO hr. Directory created. 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).
88.fyicenter Link #1 88 07-MAY-06 1110 dev. created DATE DEFAULT (sysdate) ).---------------.----------.com Session 1 07-MAY-06 .'. The tutorial exercise below shows you how add data to the external table defined in the previous exercise: >edit /oraclexe/test/ext_fyi_links. 2 rows created.-------.88. ID URL NOTES COUNTS CREATED --------.---------------. ID URL NOTES COUNTS CREATED --------.dev. url VARCHAR2(16) NOT NULL. you can add data to the text file.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. you can easily load data from this text file to a regular table.07-MAY-06 >sqlplus /nolog SQL> connect HR/fyicenter SQL> SELECT * FROM ext_fyi_links.-------.----------.07-MAY-06 1110. SQL> SELECT * FROM fyi_links.fyicenter. SQL> INSERT INTO fyi_links SELECT * FROM ext_fyi_links. and an external table defined to this 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.--------1101 dba.--------101 fyicenter. notes VARCHAR2(16). counts NUMBER(4).fyicenter.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.txt 1101. By default. data fields in the text file should be terminated by '.Link #2.Link #1.dba. and query the text file through the external table.
0. The dump file set can be imported on the same system or it can be moved to another system and loaded there.0 The Data Pump export utility provides a mechanism for transferring data objects between Oracle databases. 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).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.1. and control information. binary format. The dump file set is made up of one or more disk files that contain table data. minimizing total elapsed time. During an import operation. as determined by the import mode.2.exe". rather than by the client. you should go to the "bin" directory of your Oracle server installation and run the "expdp" command. To invoke this utility. This is known as a network import. the data base administrator (DBA) must create directory objects. Oracle dump file set is written in a proprietary binary format by the Data Pump Export utility. How To Invoke the Data Pump Export Utility? The Data Pump Export utility is distributed as executable file called "expdp. which can be imported back to Oracle database only by Oracle Data Pump Import utility. The utility is invoked with the following command: .0\server\BIN >expdp help=y Export: Release 10.2.com 1101 dba. 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. This is done using data filters and metadata filters. the Data Pump Import utility uses these files to locate each database object in the dump file set. which are implemented through Import commands. Import can also be used to load a target database directly from a source database with no intervening dump files. This allows export and import operations to run concurrently. database object metadata.110 centerfyi. The files are written in a proprietary. Here is tutorial exercise on how to invoke the export utility: >cd \oraclexe\app\oracle\product\10. Because the dump files are written by the server.fyicenter 1110 dev.
value2.dmp ...valueN) Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.2. DIRECTORY Directory object to be used for dumpfiles DUMPFILE List of destination dump files (expdat.dmp You can control how Import runs by entering the 'impdp' command followed by various parameters.1. ATTACH [=job name COMPRESSION Reduce size of dumpfile contents where valid keyword values are: (METADATA_ONLY) and NONE..0..valueN) Example: expdp scott/tiger DUMPFILE=scott. HELP Display Help messages (N). ... you should go to the "bin" directory of your Oracle server installation and run the "impdp" command. To invoke this utility.T1:P2) USERID must be the first parameter on the command line.value2..Example: expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott. e..0 The Data Pump Import utility provides a mechanism for transferring data objects between Oracle databases..dmp You can control how Export runs by entering the 'expdp' command followed by various parameters: Format: expdp KEYWORD=value or KEYWORD=(value1..2.0\server\BIN >impdp help=y Import: Release 10. Format: impdp KEYWORD=value or KEYWORD=(value1. Keyword Description (Default) -----------------------------------------------------------ATTACH Attach to existing job. How To Invoke the Data Pump Import Utitlity? The Data Pump Import utility is distributed as executable file called "impdp. The utility is invoked with the following command: Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott..exe".g.dmp DIRECTORY=dmpdir SCHEMAS=scott or TABLES=(T1:P1. FLASHBACK_SCN SCN used to set session snapshot back to. FULL Export entire database (N)..dmp).. Here is tutorial exercise on how to invoke the import utility: >cd \oraclexe\app\oracle\product\10.
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. estimated "FLOWS_020100". Processing object DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA .dmp) FULL Import everything from source (Y). Table: Enables you to export and import specific tables and partitions. you can use the ESTIMATE_ONLY=y parameter on the expdp command. Tablespace: Enables a privileged user to move a set of tablespaces from one Oracle database to another..2.. estimated "SYSTEM". HELP Display help messages (N). Tablespace: Enables a privileged user to move metadata from the tables within a specified set of tablespaces from one Oracle database to another. Use the TABLESPACES parameter to specify this mode.g. 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. .. Schema: Enables you to export and import all objects that belong to a schema...."SYS_EXPORT_FULL_01": SYSTEM/**** FULL=y ESTIMATE_ONLY=y Estimate in progress using BLOCKS method. Use the TRANSPORT_TABLESPACES parameter to specify this mode. DUMPFILE List of dumpfiles to import from (expdat. Use the SCHEMAS parameter to specify this mode.0\server\BIN >expdp SYSTEM/fyicenter FULL=y ESTIMATE_ONLY=y Starting "SYSTEM". estimated "TSMSYS". 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. ... Oracle 10g supports 5 export and import modes: y y y y y Full: Exports and imports a full database. ATTACH [=job name] DIRECTORY Directory object to be used for dump."SYS_EXPORT_FULL_01" successfully completed MB MB MB KB KB . estimated "FLOWS_020100".."WWV_FLOW_PAGE_PLUGS" 42 . estimated "FLOWS_020100"..."WWV_FLOW_STEP_ITEMS" 27 .."SRS$" 0 Total estimation using BLOCKS method: 169. .8 MB Job "SYSTEM".. Use the FULL parameter to specify this mode."WWV_FLOW_STEP_PROCESSING" 16 . log. e.USERID must be the first parameter on the command line. Keyword Description (Default) ---------------------------------------------------------ATTACH Attach to existing job.. This is the default mode. Use the TABLES parameter to specify this mode."SQLPLUS_PRODUCT_PROFILE" 0 .
.. 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..68MB ..WWV_FLOW_STEP_ITEMS 21.DMP Job "SYSTEM"..Now you know that you need 170 MB disk space to export the entire data base. .2. exported FLOWS_020100.. SQL> COL directory_name FORMAT A16.. Oracle also records the screen output in a log file called export. How To Do a Full Database Export? If you are ready to do a full database export..WWV_FLOW_PAGE_PLUGS 32.8 MB Processing object type DATABASE_EXPORT/TABLESPACE Processing object type DATABASE_EXPORT/SYS_USER/USER Processing object type DATABASE_EXPORT/SCHEMA/USER .WWV_FLOW_STEP_PROCESSING 11. you can use the FULL=y parameter on the expdp command. >sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> COL owner FORMAT A8.log at \oraclexe\app\oracle\admin\XE\dpdump."SYS_EXPORT_FULL_01": SYSTEM/**** FULL=y Estimate in progress using BLOCKS method..------------------------------------SYS DATA_PUMP_DIR \oraclexe\app\oracle\admin\XE\dpdump\ SYS TEST_DIR /oraclexe/test SYS ORACLECLRDIR \oraclexe\app\oracle\product\10.-------------. Processing object DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA Total estimation using BLOCKS method: 169. Master table "SYSTEM". OWNER DIRECTORY_NAME DIRECTORY_PATH ----. exported FLOWS_020100.17MB ."SYS_EXPORT_FULL_01" unloaded ********************************************************** Dump file set for SYSTEM. SQL> COL directory_path FORMAT A40. . exported FLOWS_020100."SYS_EXPORT_FULL_01" successfully completed Where Is the Export Dump File Located? If you are not specifying the dump directory and file name.. The tutorial exercise below tells you find what is your default dump directory and locate the dump file.... SQL> SELECT * FROM dba_directories. . as shown in the following tutorial exercise: >expdp SYSTEM/fyicenter FULL=y ESTIMATE_ONLY=y Starting "SYSTEM".0\ server\bin\clr .51MB .
exported "HR".Obviously. If you go to that directory. . Grant succeeded."SYS_EXPORT_SCHEMA_01" successfully completed . Grant succeeded. . SQL> GRANT READ ON DIRECTORY hr_dump TO hr.SYS_EXPORT_SCHEMA_01 is: C:\ORACLEXE\HR_DUMP\SCHEMA.dmp".2.. SQL> quit >expdp hr/fyicenter SCHEMAS=hr DIRECTORY=hr_dump DUMPFILE=schema. SQL> GRANT WRITE ON DIRECTORY hr_dump TO hr.. 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": hr/******** SCHEMAS=hr DIRECTORY=hr_dump DUMPFILE=schema..632 KB 27 rows . the default dump directory is directory object defined to \oraclexe\app\oracle\admin\XE\dpdump\. you can use the "expdp" command with the SCHEMAS parameter. 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 .. exported "HR". Directory created.DMP Job "HR".. Running "expdp" command with a non-system user account requires a directory object granted to this user account..76 KB 107 rows .085 KB 25 rows .."EMPLOYEES_TEMP" 15."EMPLOYEES" 15.log Estimate in progress using BLOCKS method. .dmp LOGFILE=schema."DEPARTMENTS" 6."COUNTRIES" 6..log Starting "HR". exported "HR".86 KB 107 rows . you will find the full database dump file is called "expdat.0\server\BIN >sqlplus /nolog SQL> connect SYSTEM/fyicenter SQL> CREATE DIRECTORY hr_dump AS '\oraclexe\hr_dump'. 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. ..."SYS_EXPORT_SCHEMA_01" loaded/unloaded ********************************************************* Dump file set for HR.dmp LOGFILE=schema. exported "HR". ... Master table "HR".
dmp LOGFILE=tables.log Master table "HR".log Estimate in progress using BLOCKS method..departments DIRECTORY=hr_dump DUMPFILE=tables. ."EMPLOYEES" exists. .DMP Job "HR". exported "HR".log Processing object type TABLE_EXPORT/TABLE/TABLE ORA-39151: Table "HR"."SYS_IMPORT_TABLE_01": hr/** TABLES=employees DIRECTORY=hr_dump DUMPFILE=tables.2... the Data Pump Import utility will return an error and skip this table. 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 .. ....departments DIRECTORY=hr_dump DUMPFILE=tables."DEPARTMENTS" 6.2..dmp LOGFILE=tables. Processing object type TABLE_EXPORT/TABLE/TRIGGER Processing object type TABLE_EXPORT/TABLE/STATISTICS/TAB. Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTI."SYS_EXPORT_TABLE_01" loaded/unloaded *********************************************************** Dump file set for HR.log Starting "HR".SYS_EXPORT_TABLE_01 is: C:\ORACLEXE\HR_DUMP\TABLES. exported "HR".76 KB 107 rows Master table "HR". Processing object type TABLE_EXPORT/TABLE/COMMENT Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF.0\server\BIN >impdp hr/fyicenter TABLES=employees DIRECTORY=hr_dump DUMPFILE=tables..dmp LOGFILE=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.0\server\BIN >expdp hr/fyicenter TABLES=employees.How To Export Several Tables Together? If you don't want to export the entire schema and only want to export several tables only... you can use the "expdp" command with the "TABLES" parameter as shown in the following tutorial exercise: >cd \oraclexe\app\oracle\product\10...."EMPLOYEES" 15. ..dmp LOGFILE=tables. The following exercise shows you a good example: >cd \oraclexe\app\oracle\product\10."SYS_EXPORT_TABLE_01": hr/******** TABLES=employees."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.632 KB 27 rows ."SYS_IMPORT_TABLE_01" loaded/unloaded Starting "HR".
. even if they reside on platforms with different hardware and software configurations. Table dropped.0\server\BIN >sqlplus /nolog SQL> connect HR/fyicenter SQL> DROP TABLE fyi_links. if any. objects (such as tables) are extracted.2.log Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA . The files can also be used as backups in addition to normal backup procedures.. 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. . The Import utility reads the object definitions and table data from the dump file. imported "HR"."SYS_IMPORT_TABLE_01" loaded/unloaded Starting "HR". Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TAB..375 KB 4 rows Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CON."SYS_IMPORT_TABLE_01": hr/** TABLES=fyi_links DIRECTORY=hr_dump DUMPFILE=schema. SQL> exit."SYS_IMPORT_TABLE_01" successfully completed..dmp LOGFILE=tables. Export and Import utilities are now being replaced by Data Pump Export and Import utilities in Oracle 10g. schema export or a table export..How To Import One Table Back from a Dump File? If you only want to import one table back to the database. 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. . you can use a dump file that was created by full export. Job "HR". An export file is an Oracle binary-format dump file that is typically located on disk or tape. followed by their related objects (such as indexes."FYI_LINKS" 6. But you can still use them.. and grants). The files can then be used with the Import utility to transfer data between databases that are on systems not connected through a network. >impdp hr/fyicenter TABLES=fyi_links DIRECTORY=hr_dump DUMPFILE=schema.log Master table "HR". When you run Export against an Oracle database. The extracted data is written to an export dump file.dmp LOGFILE=tables. Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTI. The dump files can be transferred using FTP or physically transported (in the case of tape) to a different site. comments.
valueN) Example: EXP SCOTT/TIGER GRANTS=Y TABLES=(EMP.oracle.. you can control how Export runs by entering the EXP command followed by various arguments.html.value2. you use: Format: EXP KEYWORD=value or KEYWORD=(value1..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. When you install an Oracle server or a client tools on your Windows system...T1:P2).DEPT. the appropriate ODBC driver will be installed for you automatically..2. if T1 is partitioned table . What Is Open Database Communication (ODBC)? ODBC. >imp help=y .. a standard API (application program interface) developed by Microsoft for Windows applications to communicate with database management systems. If you want to install a specific ODBC driver. you need to go to http://www.. .... Open Database Communication.. The tutorial exercise below tells you how to run the export and import utilities in help modes: >cd \oraclexe\app\oracle\product\10.How To Invoke the Original Export Import Utilities? If you really want to run the original export import utilities.com/technology/software/tech/windows/odbc/index. How To Install Oracle ODBC Drivers? Oracle offers different ODBC drivers for different versions of Oracle servers. Oracle offers ODBC drivers to allow Windows applications to connect Oracle server through ODBC..MGR) or TABLES=(T1:P1.. you can still go to "bin" directory of the Oracle server path and run the "exp" or "imp" command. Download the right ODBC driver and follow the instructions to install it.. To specify parameters.
A Windows application can connect to an Oracle server indirectly through Windows ODBC manager. if it knows how to use the Oracle TNS technology. becaused offers ODBC drivers to support the ODBC API. Oracle ODBC drivers should be on the list.How To Find Out What Oracle ODBC Drivers Are Installed? To find out what Oracle ODBC drivers are installed on your Windows system. The diagram below shows how MS Access can connect to an Oracle server through the ODBC driver: . For example. Click the Add button. Run Data Sources (ODBC). you can use the ODBC manager to look at them: y y y y y Go to Control Panel. Go to Administrative Tools. "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. 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. Go to System DSN tab.
ora. SQL> CREATE USER fyi IDENTIFIED BY retneciyf ACCOUNT UNLOCK. INTO dev_faq VALUES (3). SQL> GRANT CREATE TABLE TO fyi. User created. SQL> connect fyi/retneciyf. SQL> GRANT CREATE SESSION TO fyi. SQL> ALTER USER dev QUOTA 4M ON USERS. INTO dev_faq VALUES (7).How To Create Tables for ODBC Connection Testing? If you want to follow the tutorial exercises in the sections below. Connected. tnsnames. Grant succeeded. Grant succeeded. . SQL> SQL> SQL> SQL> CREATE INSERT INSERT INSERT TABLE dev_faq (id NUMBER). User altered. User altered. you need to create a user account and a table for ODBC connection testing as shown here: SQL> CONNECT system/retneciyf Connected. INTO dev_faq VALUES (5). the TNS is automatically installed with a simple configuration file. 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 fyi DEFAULT TABLESPACE USERS. to define Oracle connect identifiers.
if you have Oracle XE server installed. you will have the tnsnames. Enter Password: retneciyf. Click the Add button. Enter TNS Service Name: XE.For example. Enter Description: FYIcenter DSN Oracle Setting. 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. Click the Test Connection button. Go to Administrative Tools. Select the "Oracle in XE" driver. You should see a "Connection successful" as shown in the following picture: .2. 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. Go to System DSN tab.0\server\NETWORK\ADMIN. Click the OK button.ora located at \oraclexe\app\oracle\product\10. Enter Data Source Name: FYI_DSN. Enter User Name: fyi. Run Data Sources (ODBC).
Select "FYI_DSN". Enter User Name: fyi.How To Connect MS Access to Oracle Servers? Once you got a DSN defined in the ODBC manager that connects to an Oracle server. The Import dialog box shows up. Click the Machine Data Source tab. You should see the Oracle ODBC Driver Connect dialog box as shown in the picture below: . 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. You should see the DSN name "FYI_DSN" you defined earlier.. Select Get External Data. Select Import.. Select Files of type: ODBC Database().. The Select Data Source dialog box shows up. Go to File menu. Enter Password: retneciyf. and link an Access table to Oracle table. you can connect a normal MS Access document to the Oracle server.
Connection") oConn. you need to install the correct Oracle ODBC driver and define a DSN on the IIS Web server. Then you can use ADODB objects to connect to the Oracle server over the ODBC driver in your ASP pages.Open "DSN=FYI_DSN. 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.CreateObject("ADODB. The tutorial example below gives you a good example: <% Set oConn = Server.PWD=retneciyf" Set oRS = oConn. you can get data from Oracle servers into your ASP pages through ODBC drivers.UID=fyi. To do this.Click the OK button to continue.Execute("SELECT * FROM dev_faq") .
If it is specified. The default value is N. If it is not specified the tables that already exist will be skipped. 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... You have a rollback segment in a version 7.2 database that has expanded beyond optimal.Response.write("<pre>") Do While NOT oRS.write("</pre>") oRS. CREATE TABLE.close oConn. export-import. . SHRINK command.EOF Response. AS SELECT. how can it be restored to optimal? Level: Low Expected answer: Use the ALTER TABLESPACE .. Give one method for transferring a table from one schema to another: Level:Intermediate Expected Answer: There are several possible methods. 2. 4. 3.MoveNext Loop 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 error is ignored and the tables data will be inserted. 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). or COPY..write("<p>Data from Oracle server via ODBC:") Response.Write(oRS("ID") & vbcrlf) oRS..close %> DBA 1.
SQL series of SQL procedures. 6.5. but only as part of the index definition. 8. 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. However. (On UNIX) When should more than one DB writer process be used? How many should be used? Level: High . DBMS_DDL. 10. This is bad since it makes tracking which table the constraint belongs to or what the constraint does harder. 9. DBMS_SQL. The packages used by DBAs may include: DBMS_SHARED_POOL. DBMS_OUTPUT and DBMS_SNAPSHOT. These can be viewed as extra credit but aren?t part of the answer.SQL or CAT*. 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. 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. Oracle doesn?t store this information as a part of the constraint definition. 7. DBMS_UTILITY. this can cause serious performance problems. for the enable clause you must specify the USING INDEX and TABLESPACE clause for primary keys. 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. DBMS_SESSION. 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. when the constraint was disabled the index was dropped and the information is gone. Since this will usually be the same tablespace as the table is being created in. They may also try to answer with the UTL*.
) 15. So no. 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. you couldn't recover. A developer is trying to create a view and the database won?t let him. . How can you tell if a database object is invalid? Level: Low Expected answer: By checking the STATUS column of the DBA_. 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.) or has a synonym that points to the object (CREATE SYNONYM emp FOR scott. You can't create a stored object with grants given through a role. 14.emp. 12.Expected answer: If the UNIX system being used is capable of asynchronous IO then only one is required. 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.emp. He has the "DEVELOPER" role which has the "CREATE VIEW" system privilege and SELECT grants on the tables he is using. ALL_ or USER_OBJECTS views. 13. A user is getting an ORA-00942 error yet you know you have granted them permission on the table. 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. You are using hot backup without being in archivelog mode. 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. 11. what is the problem? Level: Intermediate Expected answer: You need to verify the developer has direct grants on all tables used in the view. instead of SELECT empid FROM emp.
Another way is to check the current_logins parameter in the v$sysstat view. Installation/Configuration 1. but this only works against a single instance installation. 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. 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.7 or so) then the index should be rebuilt.e. Define OFA. Level: Low Expected answer: OFA stands for Optimal Flexible Architecture. This table is a single row. his select is: SELECT pk_seq. 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. 17.0 (i. One is to look at the v$session or v$process views. single column table that should only have one value in it. 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. Or if the ratio BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0. 19. 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.16. 18. If you have an example table. A user selects from a sequence and gets back two values. greater than 0. Another if you are on UNIX is to do a "ps -ef|grep oracle|wc -l? command.3. What is the problem? Level: Intermediate Expected answer: Somehow two values have been inserted into the dual table. .nextval FROM dual.
They should indicate how they will handle archive logs and exports as well. SQLNET. TNSNAMES. If archive logging is turned on during install a large number of logs will be created. . 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. 4.ORA 7. TNSNAMES.ORA file 6. 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. When configuring SQLNET on the server what files must be set up? Level: Intermediate Expected answer: INITIALIZATION file. redo logs on two (mirrored redo logs) the TEMPORARY tablespace on another. When configuring SQLNET on the client what files need to be set up? Level: Intermediate Expected answer: SQLNET. 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. You have installed Oracle and you are now setting up the actual instance. ROLLBACK tablespace on another and still have two for DATA and INDEXES.2. 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. As long as they have a logical plan for combining or further separation more or less disks can be specified. 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. You have been waiting an hour for the initialization script to finish. Be sure enough contiguous disk space is available. This can fill up your archive log destination causing Oracle to stop to wait for more space. 3. data and indexes and isolation os SYSTEM tables from other tables. 5.ORA.
You have just started a new instance with a large SGA on a busy existing server. How many disks should you have assuming standard layout for SYSTEM. You have a simple application with no "hot" tables (i. How many control files should you have? Where should they be located? Level: Low Expected answer: At least 2 on separate disk spindles. How can you determine the space left in a file system? Level: Low Expected answer: There are several commands to do this: du. 9. 12. 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. or bdf . UNIX 1. uniform IO and access requirements). USER. not just file systems. Performance is terrible. Be sure they say on separate disks. df. 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. see disk configuration answer above. 13.8. The redo logs should not be on raw devices on UNIX if it can be avoided.e. When should the default values for Oracle initialization parameters be used as is? Level: Low Expected answer: Never 11. 10.
How can you find all the processes on your system? Level: Low Expected answer: Use the ps command 14. pg 4. should he be proud of this? Level: High Expected answer: Maybe. 11. usually a case-esac or an if-endif or fi structure 7. if you do a ps -ef|grep oracle|wc -l you can get a count of the number of users. It is stored in both disk and memory and tracts file status. How do you create a decision tree in a shell script? Level: intermediate Expected answer: depending on shell.2. This is one of the strengths of UNIX allowing the output from one command to be redirected directly into the input of another command. the greater than symbol ">" or the "tee" command. 10. This can be done using the pipe symbol "|". The system has a program that always includes the word nocomp in its name. How can you find dead processes? Level: Intermediate Expected answer: ps -ef|grep zombie -. 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. What is an inode? Level: Intermediate Expected answer: an inode is a file status indicator. 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. more. What command is used to remove a file? Level: Low Expected answer: rm 5. 12.who -d depending on the system. 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. 3. What command is used to type files to the screen? Level: Low Expected answer: cat. There is one inode for each file on the system. Some UNIX systems don?t clean up well after themselves. Most UNIX systems should have a scheduled periodic reboot so file systems can be checked and cleaned and dead or zombie processes cleared out. 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. The system administrator tells you that the system hasn?t been rebooted in 6 months.or -. . Can you remove an open file under UNIX? Level: Low Expected answer: yes 6. Inode problems and dead user processes can accumulate causing possible performance and corruption problems. 13.
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. can't get err txt. For SQLNET V2 check for the presence of the LISTENER process(s) or you can issue the command "lsnrctl status".dbf file. dbwr and lgwr. Any answer that has them using their operating system process showing feature to check for these is acceptable.  Oracle Troubleshooting 1. It is located in the directory specified by the background_dump_dest parameter in the v$parameter table. Users from the PC clients are getting messages indicating : Level: Low ORA-06114: (Cnct err. other protocols have similar command formats. Users aren?t being allowed on the system. 16. For example.15. these will be smon. The following message is received: Level: Intermediate ORA-00257 archiver is stuck. See Servr Msgs & Codes Manual) What could the problem be? Expected answer: The instance name is probably incorrect in their connection string. 5. 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. pmon. What is the easiest method to create a file on UNIX? Level: Low Expected answer: Use the touch command 17. 18. 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. 3. What file will give you Oracle instance status information? Where is it located? Level: Low Expected answer: The alert. Review the results from the command to find the command of interest.ora log. You can use the command "tcpctl status" to get a full status of the V1 TCPIP server. 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. until freed What is the . What does >> do? Level: Intermediate Expected answer: The ">>" redirection symbol appends the output from the command specified into the file specified. 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. 4. Connect internal only. on UNIX a ps -ef|grep pmon will show what instances are up. What is the finger command? Level: Low Expected answer: The finger command uses data in the passwd file to give information on system users. 2. 6. restart the instance. The file must already have been created.
8. 9.. (bring read-only tablespaces back online) Shutdown and backup the system. they will need to know all of the datafiles. You can shutdown and reset this to a higher value.) RECOVER DATABASE USING BACKUP CONTROLFILE ALTER DATABASE OPEN RESETLOGS. However. up to the value of MAX_DATAFILES as specified at database creation.. MAXLOGHISTORY. 10. What is the problem? Level: High Expected answer: Check the dba_tablespaces view for the value of pct_increase for the tablespaces. If no backup of the control file is available then the following will be required: CONNECT INTERNAL STARTUP NOMOUNT CREATE CONTROL FILE . MAXDATAFILES for the database to use the command .problem? Expected answer: The archive destination is probably full. MAXLOGMEMBERS.. 7.log file for this information. Increase the value of DML_LOCKS. If the MAX_DATAFILES is set to low. you can have them wait and then try again later and the error should clear. If pct_increase is zero. 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 . then restart If they have a recent output file from the ALTER DATABASE BACKUP CONTROL FILE TO TRACE. command.. You get a call from you backup DBA while you are on vacation. 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. smon will not coalesce their free space.. and settings for MAXLOGFILES. He has corrupted all of the control files while playing with the ALTER DATABASE BACKUP CONTROLFILE command. logfiles. You look at your fragmentation report and see that smon hasn?t coalesced any of you tablespaces. backup the archive logs and remove them and the archiver will re-start. you will have to rebuild the control file to increase it before proceeding.. 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. If you are sure that this is just a temporary problem.. you must check the alert. OFFLINE. even though you know several have large chunks of contiguous free extents. If this value is set to low (which it is by default) you will get this error. 11. 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..
Give details on GTX0-j :The process provides transparent support for XA global transactions in a RAC environment. The GES and GCS maintains records of the statuses of each datafile and each cahed block using global resource directory. 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.The database autotunes the number of these processes based on the workload of XA global transactions. Give details on LMON:This process monitors global enques and resources across the cluster and performs global enqueue recovery operations. To enable inter instance communication Oracle RAC makes use of interconnects.This process maintains statuses of datafiles and each cahed block by recording information in a Global Resource . Give details on LMS:This process is called as Global Cache service process. media failover features. Give Details on ACMS:ACMS stands for Atomic Controlfile Memory Service.This process is referred to as cache fusion and helps in data integrity.Oracle RAC instances use two processes GES(Global Enqueue Service). This process manages incoming remote resource requests within each instance. They are composed of Memory structures and background processes same as the single instance database. It is a clustering solution from Oracle Corporation that ensures high availability of databases by providing instance failover. Mention the Oracle RAC software components:Oracle RAC is composed of two or more database instances. GCS(Global Cache Service) that enable cache fusion.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. Give Details on Cache Fusion:Oracle RAC is composed of two or more instances.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 LMD:This process is called as global enqueue service daemon.This is called as Global Enqueue Service Monitor. The Global Enqueue Service(GES) monitors and Instance enqueue process manages the cahce fusion.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.Oracle RAC(Real Application Cluster) DBA Interview Questions What is RAC? RAC stands for Real Application cluster.
This process manages background slave process creation andd communication on remote instances. redolog files when these files are hosted out of cluster-aware shared storage which are group of shared disks.This process performs tasks on behalf of a co-ordinating process running in another instance. OCFS2 and OCFS(Oracle Cluster Fie systems).Windows clusters use the TCP protocol.This processing is a part of cache fusion feature. .Dectory(GRD). SPFIles. 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.control files. controlfiles. redo log files must reside on cluster-aware shred storage. 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. The interconnect network uses a switch/multiple switches that only the nodes in the cluster can access. This is a background slave process.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.raw disk devices.On unia and linux systems we use UDP and RDS(Reliable data socket) protocols to be used by Oracle Clusterware. Can we use crossover cables with Oracle Clusterware interconnects? No.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. Give few examples for solutions that support cluster storage:ASM(automatic storage management).These pocesses perform managability tasks for Oracle RAC. How can we configure the cluster interconnect? Configure User Datagram Protocol(UDP) on Gigabit ethernet for cluster interconnect. crossover cables are not supported with Oracle Clusterware intercnects. What components in RAC must reside in shared storage? All datafiles. What is an interconnect network? an interconnect network is a private network that connects all of the servers in a cluster. Give details on LCK0:This process is called as Instance enqueue process.network file system(NFS). SPFILE's.
with or without connection pooling. What is the use of a service in Oracle RAC environemnt? Applications should use the services feature to connect to the Oracle database. 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. Clients that attempt to connect to the VIP address receive a rapid connection refused error . What is the significance of VIP address failover? When a VIP address failover happens. What are the characteriscs controlled by Oracle services feature? The charateristics include a unique name. What is the use of VIP? If a node fails. workload balancing and failover options. and the IP addresses must use the same subnet as the public network.and high availability characteristics.Services enable us to define rules and characteristics to control how users and applications connect to database instances. we need to reserve a spare IP address for each node.They don't have to wait for TCP connection timeout messages.What is the use of cluster interconnect? Cluster interconnect is used by the Cache fusion for inter instance communication. To configureVIP address. 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. all interfaces for the VIP address are disconnected from the network. Give situations under which VIP address failover happens:VIP addresses failover happens when the node on which the VIP address runs fails. all interfaces for the VIP address fails. 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 . . 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.Users can use oracle services feature to connect to database.
Oracle RAC high availability framework publishes a FAN event immediately when a state change occurs in the cluster.we can deinstall the Oracle database software independent of the ASM instance.This helps in upgrading and patching ASM and the Oracle database software independent of each other.Also.UP or DOWN events. .This prevents applications from polling database and detecting a problem after such a state change.SQL*PLUS.Applications can respond to FAN events and take immediate action.So applications can receive FAN events and react immediately. State the use of FAN events in case of a cluster configuration change? During times of cluster configuration changes. 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.What are the administrative tools used for Oracle RAC environments? Oracle RAC cluster can be administered as a single image using OEM(Enterprise Manager).DBCA.services and nodes.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. What is FAN? Fast application Notification as it abbreviates to FAN relates to the events related to instances. Where can we apply FAN UP and DOWN events? FAN UP and FAN DOWN events can be applied to instances.ASM does this by distributing the database file across all of the available storage within our cluster database environment. $connect sys/sys as sysdba SQL>select * from V$ACTIVE_INSTANCES.clusterverificationutility(cvu). 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).host_:instancename under INST_NAME column.NETCA How do we verify that RAC instances are running? Issue the following query from any one node connecting through SQL*PLUS.services and nodes.Servercontrol(SRVCTL).
ASM instances in Oracle database 11g release(from 11.1) can be upgraded or patched using rolling upgrade feature.an instance.a service. 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.Some examples of CRS resources are database. Mention the components of Oracle clusterware:Oracle clusterware is made up of components like voting disk and Oracle Cluster Registry(OCR).an application process etc.1). What is the use of OCR? Oracle clusterware manages CRS resources based on the configuration information of CRS .Their value must be specified in SPFILE or PFILE for every instance.Anything that Oracle Clusterware manages is known as a CRS resource. This enables us to patch or upgrade ASM nodes in a clustered environment without affecting database availability.a listener. What is a CRS resource? Oracle clusterware is used to manage high-availability operations in a cluster. 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.it can be used only for Oracle database 11g releases(from 11. Can rolling upgrade be used to upgrade from 10g to 11g database? No.a VIP address.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.What is rolling upgrade? It is a new ASM feature from Database 11g.
In addition we have GV$ views called as global views that has an INST_ID column of numeric data type./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.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).resources stored in OCR(Oracle Cluster Registry).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 . .GV$ views obtain information from individual V$ views. 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.Command-line tool for managing Oracle Cluster Registry OCRDUMP . 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 .allocating and deallocating network interfaces OCRCONFIG . Name some Oracle clusterware tools and their uses? OIFCFG .
. there are two types of redo transport services : 1) Synchronous Redo Transport (SYNC). 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) .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.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 .In case of server-side load balancing listener uses a load-balancing advisory to redirect connections to the instance providing best service. 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.blogspot.Synchronous Redo Transport (SYNC) Oracle dataguard 11g is the latest high availability solution from Oracle Corporation.It uses the concept of primary database and one or more standby databases to provide high availability. 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.This is the LNS counterpart at standby database site. 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.com/2009/10/oracle-dataguard-11g-redo-transport_16.Basic mechanism behind standby database configuration is the Redo Transport Services. wherein redo data is shipped from Primary database to one or more standby databases.Redo Transport Services . corresponding redo vectors are written from redo log buffer in SGA to online redo log file using the process LGWR (Log Writer). 1) Whenever an user commits a transaction.Some important processes are : 1) Log Network Server (LNS) . http://neworacledba.html A comprehensive set of Oracle dataguard processes help in redo shipping.Runs on primary database. 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.
It doesn't require an active database instance. Both are operating systems upon which all the applications run.ifr connect_string:source_filename connect_string:targetfilename . Solaris is the form of unix customized by Sun Microsystems. Some unix commands are common to both linux and solaris whereas some commands differ. ASMCMD has COpy option included to it.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. It is now acquired by Oracle Corporation. There are many open source forms and groups that helps us information on linux.ASMCMD copy command can be used to transfer files. Storage Manager) 11g . SuSe. Linux is a freeware and some vendors like fedora core offer linux whichcan be downloaded and installed for free. 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).html Usage : cp .It is used to copy database files into and out of ASM diskgroups in local system or an remote system. Linux is an open source.Red Hat. Solaris is licenced version from sun microsystems (can be fixed or floating licence).ASMCMD Copy Command From Oracle database 11g.com/2009/10/oracle-asm-automatic-storage-manager_22. Sun has its own form of hardware called as sun servers which are used to host solaris.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. Check the documentation of the vendor before installing linux to confirm the compatability of linux in the particular hardware.blogspot. Both Linux and Solaris are flavours of UNIX. Debian etc.
Some important processes are : 1) Log Network Server (LNS) .blogspot.com/2009/10/oracle-dataguard-11g-redo-transport_16. an ASM alias target_filename .recursive copy. http://neworacledba. 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) .This is the LNS counterpart at standby database site. Not needed for local system. . Copies all subdirectories source_filename . In case of local system port number is 1521 Oracle Dataguard 11g . 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. i .Interactive copy. Prompt before copying or overwriting the file f .target file name target_directory . 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 . remove it and try again without user interaction r .Where options are.connection string used in case of remote instance copy. there are two types of redo transport services : 1) Synchronous Redo Transport (SYNC).html A comprehensive set of Oracle dataguard processes help in redo shipping.Synchronous Redo Transport (SYNC) Oracle dataguard 11g is the latest high availability solution from Oracle Corporation. Same as normal copy command. It is of form host:port.Basic mechanism behind standby database configuration is the Redo Transport Services.Redo Transport Services .It uses the concept of primary database and one or more standby databases to provide high availability. It can be fully qualified filename(full path). wherein redo data is shipped from Primary database to one or more standby databases.If the destination file already exists.Source file name.Runs on primary database.
corresponding redo vectors are written from redo log buffer in SGA to online redo log file using the process LGWR (Log Writer).blogspot.com/2009/10/oracle-dataguard-11g-redo-transport_16.1) Whenever an user commits a transaction.html . For full story read : http://neworacledba. 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.
This action might not be possible to undo. Are you sure you want to continue?