Wednesday, January 22, 2020

Moving Datafile on an Oracle Physical Standby

There are situations where the standby server does not have the same mounts as the prod server. In this situation when the SA is incapable, as a DBA you can be a hero again by following these steps.


Steps

1. ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; --stop it

2. alter system set standby_file_management=manual;

3. shweeb.ecp.priv:/dba0B/oradata/ORAP> mv APPS_TS_SUMMARY05.dbf /dba0A/oradata/ORAP
    shweeb.ecp.priv:/dba0B/oradata/ORAP> mv APPS_TS_SUMMARY06.dbf /dba0A/oradata/ORAP

4.alter database rename file '/dba0B/oradata/ORAP/APPS_TS_SUMMARY05.dbf' to '/dba0A/oradata/ORAP/APPS_TS_SUMMARY05.dbf';

alter database rename file '/dba0B/oradata/ORAP/APPS_TS_SUMMARY06.dbf' to '/dba0A/oradata/ORAP/APPS_TS_SUMMARY06.dbf';


5. shutdown immediate;
6. startup nomount;
7. alter database mount standby database;
8. alter database recover managed standby database disconnect from session;

Check the progress

1. DR Log sync

--Checking Logs

select max(sequence#) from v$archived_log where applied='YES';
select sequence# from v$archived_log where applied='NO';



--CHECK WHERE IT IS STUCK
select SEQUENCE#,DELAY_MINS,STATUS,PROCESS FROM v$managed_standby;

Sunday, November 3, 2019

LINUX Change Home Directory

Change the home directory of a Linux user with a simple usermod command. While creating a user if you didn’t specify any –home parameter Linux assumes the home directory of the user to be /home/username even if you did specify you can later change it to something else according to your needs. Apart from changing the home directory using the usermod command you’ll have to assign proper ownership and permissions to the new folder. You can also change the home directory by editing the /etc/passwd file. I’ll outline both the steps here.

Change the home directory using usermod

This method is for command line warriors. Before you use the usermod command the new home directory should be created, ownership should be assigned to the new user and the folder should be chmoded correctly so that no one else can access it. Run the following commands to do it.
mkdir /home/new_home_directory
chown username:username /home/new_home_directory
chmod 700 /home/new_home_directory
usermod --home /home/new_home_directory username

Change the home directory by editing /etc/passwd

Alternatively you can also edit the /etc/passwd to change the home directory. But you should be careful not to edit anything else. Before editing this file it is always better to create the new home directory and assign proper permissions and ownership to it. Execute the following commands.
mkdir /home/new_home_directory
chown username:username /home/new_home_directory
chmod 700 /home/new_home_directory

Open the /etc/passwd file using a text editor and locate the line containing the required username it should look something like this
username:x:500:500::/home/username:/bin/bash
change it to
username:x:500:500::/home/new_home_directory:/bin/bash
Save the file.
Finally copy all the old content to the new home directory
cp -f /home/username/* /home/new_home_dir/

Tuesday, October 22, 2019

adgendbc.sh INSTE8_SETUP 1

Autoconfig Fails with error adgendbc.sh INSTE8_SETUP 1
login to database and check

show parameter jit, set it to false from true

alter system set JAVA_JIT_ENABLED= FALSE scope = both;

Bounce both DB and Application Tier and then re-run the autoconfig. The autoconfig will complete successfully

ref:Adgendbc Fails With Database Connection Failure (Doc ID 1302708.1)

Monday, October 21, 2019

ORA-17629: Cannot connect to the remote database server

The situation was I had to clone another ebs from artemis:hrcp to Athena:hrcd..  This two servers were created hap hazardly before. My plan was to restore o cone the Athena with artemis using rman duplicate. normally I would use a dr to do this. but unfortunately artemis does not have a dr site. Instead we will be duplication g from al ive database.

The hallenges I had was with connection.s.

I keep getting n n error that I connect to the remote server.

Artemis cannot ping hrcp and hrcd this is further complicated that it was looking for iflies. so I had to ocpy the old files. example
hrp_

Tuesday, October 15, 2019

Monday, October 14, 2019

ERROR at line 1: ORA-01940: cannot drop a user that is currently connected

SQL>  select s.sid, s.serial#, s.status, p.spid
from v$session s, v$process p
where s.username = 'CHRS'
and p.addr (+) = s.paddr;  2    3    4

       SID    SERIAL# STATUS   SPID
---------- ---------- -------- ------------------------
       139      17563 INACTIVE 21630
       142      56779 ACTIVE   10920
       148      20995 INACTIVE 27150
SQL> alter system kill session '142,56779';

System altered.

Saturday, October 12, 2019

Moving UNDO datafiles Oracle

SELECT a.name,b.status , d.username , d.sid , d.serial#
FROM   v$rollname a,v$rollstat b, v$transaction c , v$session d
WHERE  a.usn = b.usn
AND    a.usn = c.xidusn
AND    c.ses_addr = d.saddr
AND    a.name IN (
  SELECT segment_name
  FROM dba_segments
 WHERE tablespace_name = 'RBS'
);

create undo tablespace UNDOTBS2 datafile '/dba0B/oradata/ORAP/UNDOTBS01.DBF' size 5000M;

select tablespace_name, status, count(*) from dba_rollback_segs group by tablespace_name, status;

ALTER SYSTEM SET UNDO_TABLESPACE = UNDOTBS2 SCOPE=BOTH;

select * from dba_rollback_segs group by tablespace_name, status;


select count(segment_name),sum(bytes/1024/1024),status from dba_undo_extents group by status;


To do
1. after rbs is offline drop it
2. create new undo tablespace /dba0a
3. switch to undotbs
4. drop unotbs2