Search This Blog

Sunday, 25 October 2020

AWS RDS Oracle Frequently used SQL Queries

 Recently I came across working on Amazon Oracle RDS database where I have to migrate the in-place oracle database to Amazon RDS. Here is my learning from that implementation of frequently used queries in Oracle / Amazon RDS.

1. Getting all the tablespace file from database

    select tablespace_name, bytes from dba_data_files;

2. Getting long running job status from database

    SELECT SID, SERIAL#, OPNAME, CONTEXT, SOFAR, 

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

    FROM V$SESSION_LONGOPS 

    WHERE OPNAME NOT LIKE '%aggregate%' 

    AND TOTALWORK != 0 

    AND SOFAR <> TOTALWORK;

 3. How to get all the files from a directory?

select * from table (rdsadmin.rds_file_util.listdir(p_directory => 'DATA_PUMP_DIR'));

4. Getting details from import Log files          

    select * from table (rdsadmin.rds_file_util.read_text_file(

       p_directory => 'DATA_PUMP_DIR',

        p_filename  => 'abc.log'));

5. Removing a file from a directory

    exec utl_file.fremove('DATA_PUMP_DIR','IMPORT.LOG');

6. How to kill a job in RDS Oracle

begin

rdsadmin.rdsadmin_util.kill(sid => sid, serial => serial_number);

end;

/

7. Providing Grant issues

    GRANT EXEMPT ACCESS POLICY TO "SYSTEM"

    GRANT GRANT ANY ROLE TO "SYSTEM" with admin option; 

    GRANT DEBUG ANY PROCEDURE TO "HR"

    GRANT CREATE VIEW TO "HR"

7. Granting Permissions to SYS Objects in AWS RDS

begin

rdsadmin.rdsadmin_util.grant_sys_object(p_obj_name => 'V_$SESSION',p_grantee => 'HR',p_privilege => 'SELECT');

end;

/

8. Exporting a Schema from a database in AWS RDS / Oracle

================================================================

DECLARE

hdnl NUMBER;

BEGIN

hdnl := DBMS_DATAPUMP.OPEN( operation => 'EXPORT', job_mode => 'SCHEMA', job_name=>null);

DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'ABC.dmp', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);

DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'ABC.log', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_log_file);

DBMS_DATAPUMP.METADATA_FILTER(hdnl,'SCHEMA_EXPR','IN (''ABC'')');

DBMS_DATAPUMP.START_JOB(hdnl);

END;

/

================================================================

9. Getting number of tables from a database

select count(*) from all_objects where object_type = 'TABLE';

10. How to drop a AQ Tables:

EXEC dbms_aqadm.drop_queue_table ( queue_table => 'HR.AQ$_HR_EMP_SQ_I',force=>true);


11. How to copy dump files from s3 bucket to database

SELECT rdsadmin.rdsadmin_s3_tasks.download_from_s3(
p_bucket_name    =>  'mys3bucketname', 
p_s3_prefix      =>  'db', 
p_directory_name =>  'DATA_PUMP_DIR') 
AS TASK_ID FROM DUAL;   

12. How to get the query of any view or table from a schema:

syntax:
select dbms_metadata.get_ddl('object_type','object_name','schema nme') from dual;
e.g:
select dbms_metadata.get_ddl('VIEW','EMPLOYEE','HR') from dual;

13. How to know when is an object created
syntax:
SELECT created FROM dba_objects  WHERE object_name = 'object_name'     AND owner =     'schema_name' AND object_type = 'object_type';

e.g:
SELECT created   FROM dba_objects  WHERE object_name =                'EMPLOYEE' AND owner =     'APPS' AND object_type = 'VIEW';

14. checking data dumping directory to check the dump files

     select * from                 
   table(RDSADMIN.RDS_FILE_UTIL.LISTDIR('DATA_PUMP_DIR')) order          by mtime;  

15. Creating Tablespaces

    create tablespace TEMP1 datafile size 5G autoextend on maxsize 10G;

16. creating a database in Oracle or Amazon RDS database

Sample Syntax:

create user schema_1 identified by <password>;

grant create session, resource to schema_1;

alter user schema_1 quota 100M on users;

Example:

CREATE USER HR IDENTIFIED BY HR

DEFAULT TABLESPACE USERS

TEMPORARY TABLESPACE TEMP

QUOTA UNLIMITED ON USERS;

GRANT CREATE SESSION, CREATE TABLE to HR;

17. Importing Dump file in Amazon RDS

Now we could start running the import process with the following command:

================================================================

DECLARE

hdnl NUMBER;

BEGIN

hdnl := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode =>        'SCHEMA',job_name=>null);

DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'HR.dmp',        directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);

DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename =>       'HR.log', directory => 'DATA_PUMP_DIR', filetype =>       dbms_datapump.ku$_file_type_log_file);

DBMS_DATAPUMP.METADATA_FILTER(hdnl,'SCHEMA_EXPR','IN (''HR'')');

DBMS_DATAPUMP.START_JOB(hdnl);

 END;

 /

================================================================

18. How to copy your dump files to S3 bucket from Linux Server

syntax: 
aws s3 cp /data/dumps/HR.dmp s3://s3-bucket-name

Wednesday, 21 October 2020

Log files Location/directory in OBIEE 12c / OAS

OBIEE 12c Log Locations:

First We should know our fusion middleware home or oracle BI Home directory location and then search in the relevant folder/directory for logs.

  • AdminServer logs – <FMW_HOME>/user_projects/domains/bi/servers/AdminServer/logs
  • bi_server1 logs – <FMW_HOME>/user_projects/domains/bi/servers/bi_server1/logs
  • Presentation Server logs – <FMW_HOME>/user_projects/domains/bi/servers/obips1/logs
  • JavaHost logs – <FMW_HOME>/user_projects/domains/bi/servers/obijh1/logs
  • Cluster Components logs – <FMW_HOME>/user_projects/domains/bi/servers/obiccs1/logs
  • Scheduler Server logs – <FMW_HOME>/user_projects/domains/bi/servers/obisch1/logs

If it is 2 Node Servers, then 

Presentation Server logs 2nd Node – <FMW_HOME>/user_projects/domains/bi/servers/obips2/logs

Scheduler Server logs For 2nd Node– <FMW_HOME>/user_projects/domains/bi/servers/obisch2/logs

OBIEE 11g Locations:

  • Upgrade logs – Middleware\Oracle_BI1\upgrade\logs
  • Admin Server logs – <FMW_HOME>\user_projects\domains\bifoundation_domain\servers\AdminServer\logs
  • Managed Server logs – <FMW_HOME>\user_projects\domains\bifoundation_domain\servers\bi_server1\logs
  • BI Server logs – <FMW_HOME>\instances\instance1\diagnostics\logs\OracleBIServerComponent\coreapplication_obis1
  • Presentation Server logs – <FMW_HOME>\instances\instance1\diagnostics\logs\OracleBIPresentationServicesComponent\coreapplication_obips1


Cheers!

Bose

Sunday, 11 October 2020

[nQSError: 13042] Repository password is wrong in OBIEE 12c

Issue;

On Oracle Business Intelligence Enterprise Edition (OBIEE) 12c, Below error occurs while uploading RPD in OBIEE 12c environment, even though RPD password is correct and can be opened with same password in offline mode.

[nQSError: 13042] Repository password is wrong

Issue 1. After uploading the RPD, if we download and try to open offline, we will get the same issue of 'Repository Password is Wrong'

Issue 2. If we are validating with validaterpd.sh command then also, we will get the same issue and will not be able to open the RPD.

Issue 3. obieerpdpwdchange utility also would not help in resetting or opening the rpd.

Issue 4. We would be able to open the RPD online but the same wouldnot be able to open if we download and try to open offline.

(Doc ID 2721582.1)

After uploading new rpd, Unable to open a downloaded rpd in offline mode in admin client tool

"Logon Failed" message is displayed and following error shown in the admin log:

----NQSAdminTool.log -------------------------

[OBIS] [NOTIFICATION:1] Opening call for File=C:\xxx\xxx\xxx.rpd, LogicalName: OfflineRepository
[OBIS] [ERROR:1] [tid: xxx]  [nQSError: 13042] Repository password is wrong. [[
file: server\objectmodel\Src\SOPersistRp.cpp; line: 672

Cause:

This issue is due to known internal Bug: Bug 29376866 - RFA : WRONG PASSWORD ERROR IN ADMIN TOOL AFTER DOWNLOADRPD

SOLUTION:

Follow the steps to fix the issue:

Step1: Open the RPD in online Mode and save the RPD suing copy as option to have working repository copy.


Step 2: Login to EM->Weblogic Domain->Security->Credentials->oracle.bi.enterprise->metadata.encryption->Edit->password =>update the same password.

Step 3: Upload the working version of RPD and then Download.

Step 3: Try opening the RPD in offline mode.


Cheers! Bose

Monday, 31 August 2020

Installing JDK-8u271in Windows

 Here is step by step by Guide for JDK Version 271. Download JDK from This Link

jdk-8u271-windows-x64.exe file will be downloaded. Just double click the download .exe file to start the Java Installation. When It prompt for permission, just click 'Allow' to start the installation.

Installer will start the Installation with the below screen. Just Click 'Next'


Installer is preparing the installation
Here is the actual first step of Installation starts.  If you are having your own directory to install Java then click 'Change' and choose the directory. Otherwise Just click 'Next'
Then JDK 8 installation is extracting to install
With the below screen, Again you could change the destination folder where Java should be installed. If you do not want to change the default folder, then Just click 'Next'
Installer window will progress and took few few minutes to complete the installation.
Once It is installed successfully, screen will prompt the below screen. Just click 'Close' to complete the installation.

You can confirm the version installed in our windows by running the "java -version" in command prompt.

Cheers!

Bose

Thursday, 6 August 2020

OAS (Oracle Analytics Server) and OAC - The Next Gen OBIEE is Here

After OBIEE 12c release, Oracle is keenly looking for cloud solutions and released OAS and OAC.

OAS is more like a in-place installation OBIEE Version which is available for download and can be installed in in-place servers or cloud server.

Otherwise, We could go for Oracle based Cloud version (OAC) of OBIEE.

Here is you can download OAS:

Step by step guide by Rittman-Mead:


Here is a Oracle Blog for OAS Installation;

Saturday, 1 August 2020

Oracle Business Intelligence Applications (OBIA) 11.1.1.10.3 is available for Download

Oracle has released the latest version of OBIA - Oracle Business Intelligence (BI) Applications 11.1.1.10.3.


What's New:

BI Applications with OBIEE 12c

ODI 12c

Look Oracle Blog Here for More Details

Upgrade Overview

Cheers!

Bose

Oracle Database 12c Step by Step Installation in Windows.

With this post, I am sharing oracle database 12c Release 2 installation in windows. I have downloaded Oracle Database 12c software which is around 2.8GB from oracle Site.

File Name: winx64_12201_database

Extract the software zip file and go to the extracted folder and double click on setup.exe file to start the DB installation.

Oracle Universal Installer checks the system prerequisite and will start the installation window. 

Uncheck 'My oracle Support' and click 'Next'
When it prompts the below window, Click 'Yes'
Select 'Create and configure a database' and click 'Next'
I have selected 'Server class' and clicked 'Next'.
Since I want to check all the feature of this database 12c, I installed with 'Server Class'. We could go with 'Desktop Class' which is light and easy. Server class is heavy and takes 6 GB disk space.
Select 'Single instance database installation' and click 'Next'
Select 'Typical Install' and click 'Next'
Select the Oracle Base folder if you have your folder to install Oracle DB 12c. I have 'DB12c' in D drive. If we select the base path, all the other path will be loaded automatically.

In this step, enter database password and remember it.

Check 'Create as container Database' and Keep pluggable DB. because pluggable DB is required for all our RCU installation required for OBIEE later.

Finally Click 'Next'
Installer will run the prerequisite checks..
With this step, We could save the response file which could be used to silent install for other environments.
Click 'Install'
It would take some time to complete the installation. 
Oracle DB installation is in progress....
Oracle DB 12c is successfully installed. Just click 'Close' to complete the installation.

Now check all the services and connect to DB. Ready to rock an roll :)

Cheers! Bose

What is Oracle Database Link and How to create database link (DB Link)

 https://www.oracletutorial.com/oracle-administration/oracle-create-database-link/

Recent Posts