1⟩ What Is Transport Network Substrate (TNS) in Oracle?
TNS, Transport Network Substrate, is a foundation technology, built into the Oracle Net foundation layer that works with any standard network transport protocol.
“Learn Oracle database programming with hundreds of Interview Questions and Answers and examples and get a better job as an Oracle DBA with this basic and advance Oracle Database Interview Questions and Answers guide”
TNS, Transport Network Substrate, is a foundation technology, built into the Oracle Net foundation layer that works with any standard network transport protocol.
Based on Oracle Web site: Oracle Database 10g Express Edition (Oracle Database XE) is an entry-level, small-footprint database based on the Oracle Database 10g Release 2 code base that's free to develop, deploy, and distribute; fast to download; and simple to administer. Oracle Database XE is a great starter database for:
* Developers working on PHP, Java, .NET, and Open Source applications
* DBAs who need a free, starter database for training and deployment
* Independent Software Vendors (ISVs) and hardware vendors who want a starter database to distribute free of charge
* Educational institutions and students who need a free database for their curriculum
ODBC, Open Database Communication, a standard API (application program interface) developed by Microsoft for Windows applications to communicate with database management systems.
Oracle offers ODBC drivers to allow Windows applications to connect Oracle server through ODBC.
Go to the Start menu, select All Programs, Oracle Database 10g Express Edition, and Start Database.
Your 10g XE Server is using about 180MB of memory even there is no users on the server. The server memory usage is displayed on your server home page, if you log in as SYSTEM.
You can start your 10g XE server from command line by:
* Open a command line window.
* Change directory to oraclexeapporacleproduct10.2.0serverBIN.
* Run StartDB.bat.
The batch file StartDB.bat contains:
net start OracleXETNSListener
net start OracleServiceXE
@oradim -startup -sid XE -starttype inst > nul 2>&1
You can shutdown your 10g XE server from command line by:
* Open a command line window.
* Change directory to oraclexeapporacleproduct10.2.0serverBIN.
* Run StopDB.bat.
The batch file StopDB.bat contains:
net stop OracleServiceXE
Your 10g XE server has a default setting for System Global Area (SGA) of 140MB. The SGA size can be changed to a new value depending on how many concurrent sessions connecting to your server. If you are running this server just for yourself to improve your DBA skill, you should change the SGA size to 32MB by:
* Log into the server home page as SYSTEM.
* Go to Administration, then Memory.
* Click Configure SGA.
* Enter the new memory size: 32
* Click Apply Changes to save the changes.
* Re-start your server.
If your default instance is in trouble, and you can not use the normal login process to reach the server, you can use a special login to log into the server without any instance. Here is how to use SQL*Plus to log in as as a system BDA:
>cd (OracleXE home directory)
>.instartdb
>.insqlplus
Enter user-name: SYSTEM/globalguideline AS SYSDBA
Connected to an idle instance
SQL> show instance
instance "local"
The trick is to put user name, password and login options in a single string as the user name. "AS SYSDBA" tells the server to not start any instance, and connect the session the idle instance.
Log in as SYSDBA is very useful for performing DBA tasks.
If you logged in to the server as a SYSDBA, you start the default instance with the "startup" command. Here is how to start the default instance in SQL*Plus in SYSDBA mode:
>.insqlplus
Enter user-name: SYSTEM/globalguideline AS SYSDBA
Connected to an idle instance
SQL> show instance
instance "local"
SQL> startup
ORA-00821: Specified value of sga_target 16M is too small,
needs to be at least 20M
Now the server is telling you more details about the memory problem on your default instance: your SGA setting of 16MB is too small. It must be increased to at least 20MB.
Let's say the SPFile for the default instance is a binary file, and some settings are wrong in the SPFile, like SGA setting is bellow 20MB, how do you change a setting in the binary file? This seems to be a hard task, because the binary SPFile is not allowed to be edited manually. It needs to be updated by the server with instance started. But you can not start the instance because the SPFile has a wrong setting.
One way to solve the problem is to stop using the binary SPFile, and use a text version of the a parameter file to start the instance. Here is an example of how to use the backup copy (text version) of the parameter file for the default instance to start the instance:
>.insqlplus
Enter user-name: SYSTEM/globalguideline AS SYSDBA
Connected to an idle instance
Oracle server version information is stored in a table called: PRODUCT_COMPONENT_VERSION. You can use a simple SELECT statement to view the version information like this:
>.insqlplus
Enter user-name: SYSTEM/globalguideline AS SYSDBA
Connected to an idle instance
SQL> COL PRODUCT FORMAT A35
SQL> COL VERSION FORMAT A15
SQL> COL STATUS FORMAT A15
SQL> SELECT * FROM PRODUCT_COMPONENT_VERSION;
PRODUCT VERSION STATUS
----------------------------------- ----------- ----------
NLSRTL 10.2.0.1.0 Production
Oracle Database 10g Express Edition 10.2.0.1.0 Product
PL/SQL 10.2.0.1.0 Production
TNS for 32-bit Windows: 10.2.0.1.0 Production
SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database Server or Client installation. It has a command-line user interface, a Windows Graphical User Interface (GUI) and the iSQL*Plus web-based user interface.
SQL*Plus has its own commands and environment, and it provides access to the Oracle Database. It enables you to enter and execute SQL, PL/SQL, SQL*Plus and operating system commands to perform the following:
* Format, perform calculations on, store, and print from query results
* Examine table and object definitions
* Develop and run batch scripts
* Perform database administration
You can use SQL*Plus to generate reports interactively, to generate reports as batch processes, and to output the results to text file, to screen, or to HTML file for browsing on the Internet. You can generate reports dynamically using the HTML output facility of SQL*Plus, or using the dynamic reporting capability of iSQL*Plus to run a script from a web page.
In order to connect a SQL*Plus session to an Oracle server, you need to:
1. Obtain the connection information from the Oracle server DBA.
2. Define a new "connect identifier" called "ggl_XE" in your tnsnames.org file with the given connection information.
3. Run the CONNECT command in SQL*Plus as shown in the tutorial exercise below:
>cd c:oraclexeapporacleproduct10.2.0server
>.insqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue ...
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> CONNECT ggl/retneclgg@ggl_XE;
Connected.
SQL> SELECT SYSDATE FROM DUAL;
SYSDATE
---------
05-MAR-06
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.
Of course, you will get an error, if you use a wrong connect identifier. Here is an example of how SQL*Plus react to a wrong connect identifier:
SQL> CONNECT ggl/retneclgg@WRONG;
ERROR:
ORA-12154: TNS:could not resolve the connect identifier
specified
Warning: You are no longer connected to ORACLE.
What you need to do in this case:
* Check the CONNECT command to make sure that the connect identifier is entered correctly.
* Check the tnsnames.ora file to make sure that the connect identifier is defined correctly.
* Check the tnsnames.ora file to make sure that there is no multiple definitions of the same connect identifier.
* Check your files system to see if you have multiple copies of tnsnames.ora in different Oracle home directories, because you installed multiple versions of Oracle. If you do have multiple copies, make sure your SQL*Plus session is picking up the correct copy of tnsnames.ora.
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.
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.
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.
The System Global Area (SGA) is a memory area that contains data shared between all database users such as buffer cache and a shared pool of SQL statements. 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.