Skip to content

Creating a 11g Database Manually by Scripts (3/3) - Configure local naming and password file for outside users

  • Oracle
Creating a 11g Database Manually by Scripts (2/3) - Create and check the new database
Even though the database is created, but it has not been connected from outside. You should configure an entry of local naming for the new database on application servers or client machines.
  1. Add a service naming on a client machine.
  2. On Windows platform, use "Oracle Net Manager" to add a service naming, or you can edit the tnsnames.ora directly and add an entry for the new database:
    smalldb =
        (ADDRESS = (PROTOCOL = TCP)(HOST = primary01-vip)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = smalldb)

  3. Test the service name on a client machine.
  4. C:\Documents and Settings\Administrator>tnsping smalldb

    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = primary01)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = smalldb)))
    OK (70 msec)

  5. Create a password file for the new database on the database server.
  6. [oracle@primary01 ~]$ orapwd FILE=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwsmalldb ENTRIES=30

    Enter password for SYS:

  7. Test the connection from an external machine.
  8. C:\Documents and Settings\Administrator>sqlplus sys/password@smalldb as sysdba
    SQL> create user hr identified by hr;

    User created.

    SQL> grant create session to hr;

    Grant succeeded.

    SQL> exit
    C:\Documents and Settings\Administrator>sqlplus hr/hr@smalldb
    SQL> select sysdate from dual;

We have proved that an outside client "hr" as well as a user with "sysdba" privilege can connect to the newly created database.

Creating a 11g Database Manually by Scripts (0/3) - An overview

Leave a Reply

Your email address will not be published. Required fields are marked *