You are on page 1of 7

Useful Oracle queries for SAP BasisAdminsitrators

Introduction on page 1

Considerations on page 2

System variables on page 2

Database on page 2

Show Oracle Database version on page 2

Show database details on page 2

Show database size on page 3

Show Oracle Instant Client Version on page 3

Installed components in Database on page 3

Is Database of type OLAP? on page 3

Instance on page 4

Show database instance details on page 4

DB Schema for SAP on page 4

Tablespaces on page 4

Show tablespaces details on page 4

List of datafiles for tablespace on page 5

Find tables being used by tablespace on page 5

Check autoextend on page 5

Users on page 5

Show database users on page 6

Unlock user account on page 6

Create user on page 6

Delete SAP* user (or another user) on page 7

Password complexity on page 7

Datafiles on page 7

Check datafiles on page 7

List of datafiles on page 8

Resize datafile until size on page 8

Redologs on page 8

List of redologs groups and files belonging to each group on page 8

Active Redolog groups on page 9

SAP Queries on page 9

system in upgrade, no import possible on page 10

BRBACKUP error on page 10


Introduction
The main goal of this document is serving as a base for SAP Basis Administrator who work with
OracleDatabases and want to perform simple checks.I will try to improve this document as much
as I can. Of course, do not hesitate to collaborate by adding more SQL queries.

Useful Oracle queries for SAP Basis AdminsitratorsGenerated by Jive on 2016-04-29+02:00


2
Considerations
DBSID: SAPSAPSID: SAP
System variables
SPOOL <filename>SET LINESIZE 32767SET WRAP OFFSPOOL OFF Check SQL*Plus
User's Guide and Reference.
Database
Show Oracle Database version
SQL> SELECT * FROM
v$version;BANNER-------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionPL/SQL Release
11.2.0.3.0 - ProductionCORE 11.2.0.3.0 ProductionTNS for IBM/AIX RISC System/6000:
Version 11.2.0.3.0 - ProductionNLSRTL Version 11.2.0.3.0 - Production
Show database details

SQL> SELECT NAME, LOG_MODE, OPEN_MODE, DATABASE_ROLE,PLATFORM_NAME


FROM v$database;

Useful Oracle queries for SAP Basis AdminsitratorsGenerated by Jive on 2016-04-29+02:00


3
NAME LOG_MODE OPEN_MODE DATABASE_ROLE PLATFORM_NAME--------- ------------------------------- ---------------- -------------------------SAP NOARCHIVELOG READ WRITE PRIMARY AIX-Based Systems (64-bit)
Show database size
SQL> SELECT SUM(BYTES)/1024/1024/1024 AS "DBSIZE(GB)" FROM dba_data_files;
DBSIZE(GB)---------5312.59766
Show Oracle Instant Client Version

SQL> select distinct client_version from v$session_connect_info where sid


=sys_context('userenv', 'sid');
CLIENT_VERSION-------------11.2.0.3.0For a list of all possibilities to check and identify Oracle Instant Client Version check
this document.
Installed components in Database
SQL> SELECT COMP_NAME, VERSION, STATUS FROM DBA_REGISTRY;
CLIENT_VERSION-------------11.2.0.3.0
Is Database of type OLAP?
SQL> SELECT * FROM V$OPTION WHERE PARAMETER = 'OLAP';