0% found this document useful (0 votes)
46 views2 pages

Unlock HR User

This document provides steps to unlock the HR user in a pluggable database (PDB) after installing a new Oracle database: 1. Add a TNS entry to connect to the newly installed database, identifying the protocol, host, and port. 2. Use SQL commands to identify the container ID and service name, then navigate the session to the desired PDB container. 3. Check if the PDB is open, opening it if needed, before unlocking the HR user and testing the connection.

Uploaded by

roopaudt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

Unlock HR User

This document provides steps to unlock the HR user in a pluggable database (PDB) after installing a new Oracle database: 1. Add a TNS entry to connect to the newly installed database, identifying the protocol, host, and port. 2. Use SQL commands to identify the container ID and service name, then navigate the session to the desired PDB container. 3. Check if the PDB is open, opening it if needed, before unlocking the HR user and testing the connection.

Uploaded by

roopaudt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

-------------------------------------------------------

Unlock hr user
-------------------------------------------------------

--Open a cmd prompt as an adminitrator


--login as system user
sqlplus / as sysdba

--try and unlock hr user


ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK;

--ERROR
--Because we are not in right location hence we need to navigate into right path

-------------------------------------------------------
--Before even navigating, we need to add an entry in tns file to connect to the
newly installed DATABASE
--TNS Entry:

--STEP1--Find out Service Name

--below query is to see the result in tabulation format


COLUMN name FORMAT a20;

--Get the container ID to get the service name


SELECT name, con_id FROM v$pdbs;

--Get the service name for the previously acquired container ID


SELECT name as "Service Name" FROM v$active_services WHERE con_id = 3;

--STEP2--Find out 3 parameters Protocol, host and port (follow the video for these
steps)
-- Navigate to %db_home%\network\admin
-- Open listner.ora file
-- Note down Protocol, Host and Port info

-- Open tnsnames.ora file


-- Create an entry for pluggable DB so that the same can be used for practicing
purpose

------------------------------------------------------
--Run the below in cmd prompt to reload the listner after the new TNS entry
lsnrctl reload
------------------------------------------------------

--Open a cmd prompt as an adminitrator


--login as system user
sqlplus / as sysdba

--run the below to know in which container you are currently in


show con_name;

--run below to Navigate to the desired container "orclpdb" where we can find HR
user
ALTER SESSION SET CONTAINER = orclpdb;

--below is to display the result in tabulation format


COLUMN name FORMAT a20;
--Check if the pdb is in open mode to perform any actions
SELECT name, open_mode FROM v$pdbs;

--If not open, then run the below statement to make the DB open else if it is
already open skip and go to next query
ALTER PLUGGABLE DATABASE open;

--run below to Unlock hr user


ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK;

--Once done, run the below To check the connection has been established or not
conn hr/hr@orclpdb;

You might also like