Sunday, June 7, 2020

How to create a backup user for ORACLE database

CREATE USER ORA_BKUP IDENTIFIED BY WHATEVER
QUOTA 1G ON  USERS;

grant sysbackup to ora_bkup;

SQL> grant create session to ora_bkup;

Grant succeeded.

SQL> grant DATAPUMP_EXP_FULL_DATABASE to ora_bkup;

Grant succeeded.

SQL> grant DATAPUMP_IMP_FULL_DATABASE to ora_bkup;

Thursday, June 4, 2020

How to enable Oracle Auditing Policy

SQL>AUDIT POLICY ora_account_mgmt;
SQL>AUDIT POLICY ora_database_parameter;
SQL>AUDIT POLICY ora_cis_recommendations;

ORACLE AUDITING

For 12c the default location is
$ORACLE_BASE/audit/$ORACLE_SID

select parameter, value from v$option  where parameter='Unified Auditing';

--Check enabled policies
select * from audit_unified_enabled_policies;

ALL USERS ORA_SECURECONFIG BY BY USER ALL USERS USER YES YES

ALL USERS ORA_LOGON_FAILURES BY BY USER ALL USERS USER NO YES

-- What does the policy do?

SELECT AUDIT_OPTION FROM AUDIT_UNIFIED_POLICIES WHERE POLICY_NAME='ORA_SECURECONFIG';


CREATE PLUGGABLE DATABASE
ALTER PLUGGABLE DATABASE
DROP PLUGGABLE DATABASE
ALTER DATABASE DICTIONARY



--Another helpful thing
SELECT * FROM DBA_AUDIT_MGMT_CONFIG_PARAMS;

DB AUDIT TABLESPACE SYSAUX STANDARD AUDIT TRAIL
DB AUDIT TABLESPACE SYSAUX FGA AUDIT TRAIL
DB AUDIT TABLESPACE SYSAUX UNIFIED AUDIT TRAIL
AUDIT FILE MAX SIZE 10000 OS AUDIT TRAIL

--Best Practice 
Create new tablespace for audit

Example:
create tablespace aud_tbs datafile '/u02/app/oracle/oradata/EPCHRS/aud_tbs.dbf'
size 500k reuse
autoextend on next 500k maxsize 100M;


--Transfer
BEGIN
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(
AUDIT_TRAIL_TYPE=>DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
AUDIT_TRAIL_LOCATION_VALUE=>'AUD_TBS');
END; 

Wednesday, June 3, 2020

Modify Default Password Complexity

Example of how to alter password complexity by setting the customized function ora_dex_verify_function;

alter profile test_profile limit password_verify_function ora_dex_verify_function;

ORACLE PASSWORD COMPLEXITY

In this article, we will show how to set up things regarding password audits.

For example, your SOX auditor requires the following.

Can we enable the below additional requirements in order to meet company policy?

  • 5 failed login attempts
  • 30 min lockout
  • 90 day expiration
  • Password history of 8
  • 2 days minimum password age

Thank you!
Sarah



Profiles only work when resource limits are turned on 

Connected to:
Oracle Database 18c Standard Edition 2 Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

SQL> show parameter resource_limit

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
resource_limit                       boolean     TRUE


To turn resource_limit  ON

SQL> ALTER SYSTEM SET RESOURCE_LIMIT = TRUE;

System altered.


--Show available profiles

select * from dba_profiles;

select distinct profile from dba_profiles;

--How to create a profile

CREATE PROFILE skull_profile LIMIT
FAILED_LOGIN_ATTEMPTS 5
PASSWORD_LOCK_TIME 30/1440
PASSWORD_LIFE_TIME 90
PASSWORD_REUSE_MAX 8
PASSWORD_VERIFY_FUNCTION ora12c_stig_verify_function;


CASE 1 New USER;

SQL> create user dav4635 identified by Administration$01 profile test profile;


CASE 2 Exisiting USER;

SQL> alter user dav4635 profile test_profile;

User altered.


For this one 

2 days minimum password age

see how to customize password complexity

How to Test UTL_FILE_DIR


SQL> show parameter UTL_FILE_DIR

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
utl_file_dir                         string      /usr/tmp, /dbapps/tmp, /dbapps
                                                 /oracle/HRD2/db/tech_st/11.2.0
                                                 /appsutil/outbound/HRD2_apollo
                                                 , /usr/tmp


DECLARE
  l_file utl_file.file_type;
BEGIN
  l_file := utl_file.fopen( '/dbapps/oracle/HRD2/db/tech_st/11.2.0/appsutil/outbound/HRD2_apollo', 'filepath_new_file_name.txt', 'W' );
  utl_file.put_line( l_file, 'Here is some text' );
  utl_file.fclose( l_file );
END;


## To add a new directory
1. edit initHRD2.ora utl_file_dir -$ORACLE_HOME/dbs
2. Bounce the database

Tuesday, June 2, 2020

Oracle how to disable options

show parameter control_management_pack_access

The possible values are:
  • NONE – disable all management packs.
  • DIAGNOSTIC – Nur DIAGNOSTIC Pack available.
  • DIAGNOSTIC+TUNING – DIAGNOSTIC and TUNING Pack available.
The value can be changed at runtime.
SQL> ALTER SYSTEM SET control_management_pack_access=NONE;