Changing SYS Password In A RAC-Data Guard Environment

Primary, Physical (redo apply) and Logical (SQL apply) Standby Databases or Active Data Guard
Post Reply
User avatar
Kristoff
Posts: 30
Joined: Thu Jan 19, 2012 2:17 pm
Location: Manila, Philippines

Changing SYS Password In A RAC-Data Guard Environment

Post by Kristoff »

Code: Select all

-- |-----------------------------------------------------------------------------|
-- |                         Changing SYS Password                               |
-- |                        In A RAC/DG Environment                              |
-- |-----------------------------------------------------------------------------|
-- | DATABASE : Oracle Database 11gR2                                            |
-- | PURPOSE  : This guide will help you on how to change the password for       |
-- |            user SYS in a RAC/DG environment                                 |
-- | NOTE     : As with any manual, ensure to test properly in a development     |
-- |            environment before attempting to perform it in PRODUCTION.       |
-- +-----------------------------------------------------------------------------+
Tested in DEV RAC/DG:
Primary: orcldb1@hostq01, orcldb2@hostq02, orcldb3@hostq24
Standby: dgorcldb1@hostq03, dgorcldb2@hostq04

1. Login to the Master Node of a Primary Database with your personal account.
2. Swith user to "oracle".
[dba00@hostq01 ~]$ sudo su - oracle
[sudo] password for dba00:
3. Check the member nodes of a Cluster for a certain database.
[oracle@hostq01 ~]$ srvctl status database -d orcldb
Instance orcldb1 is running on node hostq01
Instance orcldb2 is running on node hostq02
Instance orcldb3 is running on node hostq24
Note: From the output above, the are three (3) nodes for orcldb on a primary site.

4. Login to each node and switch user to "oracle". Login to instance as sysdba and then alter SYS user for its new password.
[oracle@hostq01 ~]$ sqlplus '/as sysdba'
SQL> alter user sys identified by "[newpassword]";

[oracle@hostq02 ~]$ sqlplus '/as sysdba'
SQL> alter user sys identified by "[newpassword]";

[oracle@hostq24 ~]$ sqlplus '/as sysdba'
SQL> alter user sys identified by "[newpassword]";

Note: a) At this point, SYS password is already altered at DB level.
Take note that in a Data Guard environment, password file on Primary and all its Standby
databases must be the same with the parameter remote_login_passwordfile=EXCLUSIVE or SHARED.

SQL> show parameter remote_login_passwordfile

Code: Select all

		NAME                                 TYPE        VALUE
			------------------------------------ ----------- ------------------------------
			remote_login_passwordfile            string      EXCLUSIVE
b) In RAC, password file for all nodes in Primary site should also be the same.
Recreating it using the orapwd tool on another node in Primary or in any of the nodes in Standby
will NOT work because the encryption does not match.

5. From Master Node of the Primary site, copy the password file to all member nodes in a cluster
with the filename format: $ORACLE_HOME/dbs/orapw<SID>

[oracle@hostq01 ~]$ cd $ORACLE_HOME/dbs
[oracle@hostq01 dbs]$ ls -ltrh orapworcldb1

Code: Select all

-rw-r----- 1 oracle oinstall 2.0K Feb  1 01:50 orapworcldb1
[oracle@hostq01 dbs]$ scp orapworcldb1 oracle@hostq02:/appl/oracle/product/11.2.0/dbs/orapworcldb2
[oracle@hostq01 dbs]$ scp orapworcldb1 oracle@hostq24:/appl/oracle/product/11.2.0/dbs/orapworcldb3

Note: At this point, the new password for SYS for all nodes on Primary site is now the same, including the password file.

6. From the Master Node of the Standby site, check the member nodes of a Cluster.
Login on hostq03 and switch user to "oracle".
[dba00@hostq03 ~]$ sudo su - oracle
[sudo] password for dba00:

[oracle@hostq03 ~]$ srvctl status database -d dgorcldb
Instance dgorcldb1 is running on node hostq03
Instance dgorcldb2 is running on node hostq04
Note: a) From above, we have two (2) nodes in a cluster for our Standby site.
b) We cannot alter SYS password via SQL*Plus on Standby site as it is in MOUNTED or READ ONLY status.
Update to the password file on the primary database is not automatically propagated
to the standby database(s). To do this, proceed to Step 7.
c) As mentioned in 4-b, re-creating the password file on the standby database is not the solution.
The reason for this is the way the passwords are encrypted in the password file. Even if the
passwords are the same, the result of the encryption is not.

7. Go back to Master Node of the Primary site. Copy the password file to all member nodes in a cluster
in your Standby site. The filename format for the destination file would be: $ORACLE_HOME/dbs/orapw<SID>

[oracle@hostq01 ~]$ cd $ORACLE_HOME/dbs
[oracle@hostq01 dbs]$ ls -ltrh orapworcldb1
[oracle@hostq01 dbs]$ scp orapworcldb1 oracle@hostq03:$ORACLE_HOME/dbs/orapwdgorcldb1
[oracle@hostq01 dbs]$ scp orapworcldb1 oracle@hostq04:$ORACLE_HOME/dbs/orapwdgorcldb2

Note: At this point, we now have the same password file across all nodes in Primary and Standby Sites.

8. Verify that redo logshipping is working.
a) From Primary site, LOG_ARCHIVE_DEST_* should be valid after manually performing a log switch.
SQL> alter system switch logfile;

SET lines 999 col DEST_NAME FOR a20
SELECT dest_name,
status,
error
FROM v$archive_dest
WHERE status <> 'INACTIVE';

Code: Select all

DEST_NAME            STATUS    ERROR
-------------------- --------- --------------------------
LOG_ARCHIVE_DEST_1   VALID
LOG_ARCHIVE_DEST_2   VALID
Note: If the remote archivelog destination (LOG_ARCHIVE_DEST_2)
has the error: "ORA-01031: insufficient privileges"
then, there is something wrong with the password file. Review the actions taken.


b) On Primary, verify the latest log sequence generated.
SQL>
SELECT thread#,
MAX(sequence#) "Last Primary Seq Generated"
FROM v$archived_log
WHERE first_time BETWEEN (sysdate-1) AND (sysdate+1)
GROUP BY thread#
ORDER BY 1;

Code: Select all

   THREAD# Last Primary Seq Generated
---------- --------------------------
         1                       1842
         2                       1750
         3                       1669

c.) From STANDBY SITE:
SQL>
SELECT a.thread#,
a.Last_Seq_Received,
b.Last_Seq_Applied,
a.Last_Seq_Received-b.Last_Seq_Applied "Difference"
FROM
(SELECT thread#,
MAX(sequence#) Last_Seq_Received
FROM v$archived_log
GROUP BY thread#
ORDER BY 1
) a ,
(SELECT thread#,
MAX(sequence#) Last_Seq_Applied
FROM v$archived_log
WHERE applied in ('YES','IN-MEMORY')
GROUP BY thread#
ORDER BY 1
) b
WHERE a.thread#=b.thread# ;

Code: Select all

   THREAD# LAST_SEQ_RECEIVED LAST_SEQ_APPLIED Difference
---------- ----------------- ---------------- ----------
         1              1842             1842          0
         2              1750             1750          0
         3              1669             1669          0
Note: Last generated on Primary should match the LAST_SEQ_RECEIVED on Standby.

-- END -- END -- END -- END -- END -- END -- END -- END -- END -- END -- END -- END -- END -- END --
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Changing SYS Password In A RAC-Data Guard Environment

Post by xaeresis »

сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Changing SYS Password In A RAC-Data Guard Environment

Post by xaeresis »

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Changing SYS Password In A RAC-Data Guard Environment

Post by xaeresis »

xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Changing SYS Password In A RAC-Data Guard Environment

Post by xaeresis »

Post Reply