Search This Blog

Tuesday, 18 August 2020

Creating a user with SYSDBA privilege

SQL>create user mussaib identified by mussaib;

user created

SQL> grant sysdba to mussaib;


Grant succeeded.


SQL> conn mussaib/mussaib as sysdba

Connected.

SQL> show user

USER is "SYS"                     ---------- (!!!!!!!!!!!!!!!!!)


SQL> select * from v$pwfile_users ;


USERNAME                       SYSDB SYSOP SYSAS

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

SYS                            TRUE  TRUE  FALSE

mussaib                          TRUE  FALSE FALSE


SQL> exit;

Disconnected from Oracle Database 11g Release 11.1.0.7.0 - 64bit Production



$ sqlplus mussaib/mussaib as sysdba


SQL*Plus: Release 11.1.0.7.0 - Production on Mon Apr 12 07:26:29 2010


Copyright (c) 1982, 2008, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Release 11.1.0.7.0 - 64bit Production


SQL> show user

USER is "SYS"              ---------- (!!!!!!!!!!!!!!!!!)

Monday, 10 August 2020

How to kill Oracle RMAN backup job

 How to kill Oracle RMAN backup job

First, get the SID and SERIAL# from below query:


SQL> select b.sid, b.serial#, a.spid, b.client_info

from v$process a, v$session b

where a.addr=b.paddr and client_info like 'rman%';

SID        SERIAL#    SPID         CLIENT_INFO

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

592        12         865          rman channel=full_chanel

OR


SQL> SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,

ROUND (SOFAR/TOTALWORK*100, 2) "% COMPLETE"

FROM V$SESSION_LONGOPS

WHERE OPNAME LIKE 'RMAN%' AND OPNAME NOT LIKE '%aggregate%'

AND TOTALWORK! = 0 AND SOFAR <> TOTALWORK;

SID        SERIAL#    CONTEXT    SOFAR      TOTALWORK  %COMPLETE

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

592        12         1          9115569    19258880   47.33

Use the following command to kill RMAN backup job:


SQL> alter system kill session '592,12' immediate;

system altered.

Backup job killed successfully, simultaneously you will get below mentioned error log in RMAN backup logs:


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of backup plus archivelog command at 09/05/2019 00:09:15

RMAN-10038: database session for channel full_chanel terminated unexpectedly


Method II:


Directly kill RMAN job from OS level with the help of “kill -9”


[oracle@PR ~]$ ps -ef | grep rman|grep -v grep

oracle 2348 3124 3 01:28 pts/1 00:00:00 rman target /

[oracle@PR ~]$ kill -9 2348

Thursday, 6 August 2020

ORA-28017: The password file is in the legacy format.

ORA-28017: The password file is in the legacy format.

Today I was trying to change password for one of my 12c database and got below error :-

SQL> alter user dbsnmp identified by "*************"
*
ERROR at line 1:
ORA-28017: The password file is in the legacy format.

Cause :- 

Looks like update to password file failed as the file format is wrong. 

Administrative privileges like sysbackup, syskm, sysdg cannot be granted unless the password file is in 12c Format

Solution :-


This error generally comes when you migrate your database from 11g to 12c

Regeneration of password will resolve this error.


PFB steps :-

1. Check which users have access to password file before regenerating it.

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM     CON_ID
------------------------------ ----- ----- ----- ----- ----- ----- ----------
SYS                            TRUE  TRUE  FALSE FALSE FALSE FALSE          0
DBSNMP                         TRUE  FALSE FALSE FALSE FALSE FALSE          0

2. Recreate your password file :-


==>orapwd file=$ORACLE_HOME/dbs/orapwamit entries=5 force=y

Enter password for SYS:
[Target_server][oracle][amit]

3. Now by default only sys have access to it

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM     CON_ID
------------------------------ ----- ----- ----- ----- ----- ----- ----------
SYS                            TRUE  TRUE  FALSE FALSE FALSE FALSE          0

4. Grant sysdba privilege to DBSNMP user to have access to password file

grant sysdba to dbsnmp;

Grant succeeded.

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM     CON_ID
------------------------------ ----- ----- ----- ----- ----- ----- ----------
SYS                            TRUE  TRUE  FALSE FALSE FALSE FALSE          0
DBSNMP                         TRUE  FALSE FALSE FALSE FALSE FALSE          0

5. Now again go for the password change, this time it will be successful.

SQL> alter user dbsnmp identified by "*************";

User altered.

I hope this article helped you.