Posts

Showing posts with the label sql scripts

Redis user permissions (ACL) and python connection

 Recently, I was working on setting up a redis cluster along with separate users for readwrite and readonly. I setup the readonly user using the below privileges (ACLs):   user redisreadonly on >mySuperSecretPassword ~* resetchannels -@all +@read +ping +asking   Once this is setup, I wrote a simple program in python to connect to the redis cluster using the readonly credentials and print the number of keys.   #!/usr/bin/env python3 """ pip3 install redis """ from redis.cluster import RedisCluster, ClusterNode # ─────── Cluster connection ─────── startup_nodes = [ ClusterNode("redis_host_1", 6379), ClusterNode("redis_host_2", 6379), ClusterNode("redis_host_3", 6379) ] rc = RedisCluster(startup_nodes=startup_nodes,decode_responses=True,username='redisreadonly',password='mySuperSecretPassw...

Find Request Set Name, Conc Manager given a request ID

Given a request id, how does one find out the program name and the manager running the request? Most of the Metalink notes and blogs provide the answer to this question but for one aspect. What is that? Read on to find out. What the SQL queries available on the web and Metalink lack is that they provide the concurrent program name for a single request given the request id. What about for a request set? Do they provide the answer? No, they don't. I have tried here to cover this aspect too. So, here goes. Note : This query works for all request ids, not only for request ids for request sets. select request_id,fcpv.CONCURRENT_PROGRAM_NAME "PROGRAM_NAME", nvl (fcr.description,fcpv.user_concurrent_program_name) "USER_PROGRAM_NAME", decode(fcpv.REQUEST_SET_FLAG,'N','SINGLE_REQUEST','Y','REQUEST_SET') "PROGRAM_TYPE", fcqv.CONCURRENT_QUEUE_NAME, fcqv.USER_CONCURRENT_QUEUE_NAME from fnd_concurrent_requests fcr, fnd_concurrent_p...

Find Tablespace Usage Percent

I have written a sql query which would output the usage percent of all the tablespaces in a given database. Although lots of tablespace usage queries are available, most of them, if not all, utilise dba_free_space view as the tool of measurement. It is well known that this view is inadequate when datafiles have autoextend feature turned on. I have tried to address this inadequacy in my query. Caveat : This query is not optimised for performance. Hence, you might observe slow performance. set linesize 100 set pagesize 10000 set feedback off verify off col tablespace_name format a18 col num_files format 999 col total_space format 9999999.99 col free_space format 9999999.99 col used_percent format 999.99 select /*+ parallel(tbs) */ tbs.tablespace_name, count(tbs.file_id) num_files, round(sum(TOTAL_SPACE),2) TOTAL_SPACE_MB, sum(FREE_SPACE) FREE_SPACE_MB, round(((sum(tbs.USED_SPACE)/sum(tbs.TOTAL_SPACE)) * 100),2) USED_PERCENT from (select ddf.file_id file_id, ddf.file_name, ddf.tablespace...

Useful Oracle Apps (EBS) Patch Queries

1. Query to find the time taken for a patch to be applied. col name for a15 col orig_patch_name for a15 col runtime for a30 SELECT NAME, ORIG_PATCH_NAME, to_char(START_DATE,'DD-MON-YYYY::HH24:MI:SS') START_DATE, to_char(END_DATE,'DD-MON-YYYY::HH24:MI:SS') END_DATE, TO_CHAR(FLOOR((end_date - start_date) * 24)) || ' hrs ' || TO_CHAR(FLOOR((end_date - start_date) * (24 * 60)) - (FLOOR((end_date - start_date) * 24) * 60)) || ' min ' || TO_CHAR(FLOOR((end_date - start_date) * (24 * 60 * 60)) - (FLOOR((end_date - start_date) * 24 * 60) * 60)) || ' sec ' RUNTIME, SUCCESS_FLAG FROM applsys.ad_patch_runs JOIN applsys.ad_patch_drivers USING (patch_driver_id) JOIN applsys.ad_appl_tops USING (appl_top_id) where orig_patch_name like '%&patch_number%' ORDER BY ad_patch_runs.creation_date DESC; 2. Note 364439.1 argues that checking ad_bugs for applied patches might not always be the good idea to check whether a given ...

Popular posts from this blog

EXCEPTION_ACCESS_VIOLATION in Jinitiator and IE crashes

Version of mod_security with EBS 11.5.10.2

Read a file and extract specific lines using Native Ansible Modules