Saturday, August 31, 2019

ORA-39071: Value for EXCLUDE is badly formed

This is for Linux
save or adjust the script below to your environment

#!/bin/bash
#Script to Perform Datapump Export
################################################################
#
. /oracle/local/.profile
export ORACLE_SID=cpwebp
#
expdate=`date '+%d%m%Y%H'`
dat=`date '+%m%d%y %H:%M'`
schema1=WEBP
################################
# export  schemas
expdp system/****** full=y dumpfile=expdp$schema1-$expdate.dmp directory=BKUPDUMP logfile=expdp$schema1-$expdate.log exclude=SCHEMA:\"IN \(\'SYSTEM\', \'PRESS\'\)\"
#Compressing files
/bin/gzip /dbapps/oracle/BACKUP/expdp$schema1-$expdate.dmp
######################################################################################
#Removing 7 days old dump and log  files
find /dbapps/oracle/BACKUP -mtime +7 -exec rm {} \;
######################################################################################
echo "hoy"

Sunday, August 25, 2019

ORA-19809

ORA-19815: WARNING: db_recovery_file_dest_size of 8499757056 bytes is 100.00% used, and has 0 remaining bytes available.
2019-08-25T07:45:13.120912-07:00
************************************************************************
You have following choices to free up space from recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
   then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
   BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
   reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
   system command was used to delete files, then use RMAN CROSSCHECK and
   DELETE EXPIRED commands.


SQL> ALTER SYSTEM SETDB_RECOVERY_FILE_DEST_SIZE = 20G SCOPE=BOTH

Thursday, August 22, 2019

RMAN

http://www.juliandyke.com/Research/RMAN/CrossCheckCommand.php


CROSSCHECK ARCHIVELOG ALL;

RMAN> DELETE EXPIRED ARCHIVELOG ALL;
RMAN> delete noprompt archivelog until time SYSDATE-10’; 
For changing tablespace:

impdp system@cpwebp DIRECTORY=ORCL_DUMP DUMPFILE=capex.dmp logfile=impdp_capex.log REMAP_TABLESPACE=USERS:CAPEX

Saturday, August 17, 2019

Current size of file recovery db_recovery_file_dest_size

SELECT name
, ceil( space_limit / 1024 / 1024) SIZE_M
, ceil( space_used  / 1024 / 1024) USED_M
, decode( nvl( space_used, 0),
0, 0
, ceil ( ( space_used / space_limit) * 100) ) PCT_USED
FROM v$recovery_file_dest
ORDER BY name
/

Wednesday, August 14, 2019

Cannot Access Oracle Express OEM

Do these three steps Then try to access it again

SELECT DBMS_XDB_CONFIG.gethttpport FROM dual;

SELECT DBMS_XDB_CONFIG.gethttpsport FROM dual;

EXEC DBMS_XDB_CONFIG.sethttpsport(5500);

Saturday, August 10, 2019

Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) TNS-12555: TNS:permission denied TNS-12560: TNS:protocol adapter error TNS-00525: Insufficient privilege for operation Linux Error: 1: Operation not permitted

Problem Symptoms

When one tries to start the Oracle Listener by executing the command "lsnrctl start" as UNIX user oracle, the following error messages appear:

---------------------------------
$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-APR-2014 20:36:19

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Starting /exlibris/app/oracle/product/11r2/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /exlibris/app/oracle/product/11r2/network/admin/listener.ora
Log messages written to /exlibris/app/oracle/diag/tnslsnr/<server_name>/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<server_name>)(PORT=1521)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=REGISTER)))
TNS-12555: TNS:permission denied
TNS-12560: TNS:protocol adapter error
TNS-00525: Insufficient privilege for operation
Linux Error: 1: Operation not permitted

Listener failed to start. See the error message(s) above...
---------------------------------

Cause

(1)
In the directory /var/tmp/.oracle there exist some socket files which do not belong to UNIX user oracle and group dba, but to another user (e.g. daemon) and another group (e.g. root).

Example:

$ ls -l /var/tmp/.oracle
4259873 0 srwxrwxrwx 1 daemon root 0 Mar 22 09:53 /var/tmp/.oracle/s#10534.1
4259874 0 srwxrwxrwx 1 daemon root 0 Mar 22 09:53 /var/tmp/.oracle/s#10534.2
4259865 0 srwxrwxrwx 1 daemon root 0 Mar 22 09:53 /var/tmp/.oracle/sREGISTER


(2)
When the Listener process starts, it tries to create the following socket files:

/var/tmp/.oracle/s#<pid>.1
/var/tmp/.oracle/s#<pid>.2
/var/tmp/.oracle/sREGISTER

where <pid> is the ID of the operating system process for the Listener.

As the file /var/tmp/.oracle/sREGISTER already exists and belongs to a UNIX user other than oracle, the Listener process (running with privileges of user oracle) cannot create a new socket file with that name. Therefore the Listener fails to start.

Resolution

(1)
Delete all socket files from directory /var/tmp/.oracle as UNIX user root.

(2)
Start the Listener by executing the command "lsnrctl start" as UNIX user oracle.

Which one is using port 1521

netstat -ntap | grep 1521

Thursday, August 8, 2019

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.13.134)(PORT=1521))';
alter system register;

Monday, August 5, 2019

Find Oracle Temp Usage

column sum_max_mb format 999,999,999;
column temporary_tablespace format A20
WITH
pivot1 AS
(
SELECT
trunc(ash.sample_time,'MI') sample_time,
ash.SESSION_ID,
ash.SESSION_SERIAL#,
ash.SQL_ID,
ash.sql_exec_id,
U.temporary_tablespace,
max(temp_space_allocated)/(1024*1024) max_temp_mb
FROM  GV$ACTIVE_SESSION_HISTORY ash, dba_users U
WHERE
ash.user_id = U.user_id
and ash.session_type = 'FOREGROUND'
and ash.temp_space_allocated > 0
GROUP BY
trunc(ash.sample_time,'MI'),
ash.SESSION_ID,
ash.SESSION_SERIAL#,
ash.SQL_ID,
ash.sql_exec_id,
U.temporary_tablespace
)
SELECT  temporary_tablespace, sample_time, sum(max_temp_mb) sum_max_mb
from pivot1
GROUP BY sample_time, temporary_tablespace
ORDER BY temporary_tablespace, sample_time
DESC;


SELECT * FROM DBA_TEMP_FREE_SPACE;

Thursday, August 1, 2019

SQL Server list connection details between dates

SELECT 
    c.session_id, c.net_transport, c.encrypt_option, 
    c.auth_scheme, s.host_name, s.program_name, 
    s.client_interface_name, s.login_name, s.nt_domain, 
    s.nt_user_name, s.original_login_name, c.connect_time, 
    s.login_time 
FROM sys.dm_exec_connections AS c 
JOIN sys.dm_exec_sessions AS s 
    ON c.session_id = s.session_id
where last_request_start_time
between  '2019-07-29' and '2019-08-01'