The DBA can grant you SELECT privileges to the V$ performance views. It's good for instance tuning, but not as effective as SQL Trace or ADVISOR privilege for query tuning.
Sharing knowledge is the ultimate key to gaining knowledge…
The only two things that stay with you for life are you & your knowledge...
Live while you can! Teach & inspire while you could & Smile while you have the teeth.
The DBA can grant you SELECT privileges to the V$ performance views. It's good for instance tuning, but not as effective as SQL Trace or ADVISOR privilege for query tuning.
To successfully run an ALTER SYSTEM command, you don't need to be the DBA, but you do need the ALTER SYSTEM privilege to be granted to you (or to the "user" owning the application through which you connect to the database - which may be different from "you" as the "user" ).
Sometimes RMAN backup files might get corrupted. Sometimes disk block corruption might happen. So it is better we do validate the database backups more frequently in order to make sure it is recoverable.
I had gone through Oracle documents, forums, and other websites but could not get a clear picture of what blocksize to choose for my environment where 64 bit OLTP databases are running. I came across the following websites that give practical and more useful information about Oracle Block size selection.
http://www.ixora.com.au/tips/buffered_block_size.htm
http://www.nextre.it/oracledocs/blocksize.html
Recently, when I tried to increase the memory_target of Oracle database, I got the following error:
ORA-00845: MEMORY_TARGET not supported on this system
While checking, we found that /dev/shm size was 2 GB, but we were trying to increase the memory_target values to 7 GB that is more than the size of /dev/shm. So we got the error.
Then we increased the /dev/shm size to 8 GB using the command as below
mount -t tmpfs shmfs -o size=8192m /dev/shm
After that, we were able to bring up the database with the parameter value memory_target =7G without the issue.
Sometimes the database user account is getting locked if the login was tried with the wrong password. In 11g database, the user account will get locked after 10 consequent failed login attempts. Oracle 11g database's default profile makes the database account password lifetime as 3 months and the number of failed login attempts as 10 days. Once these limits are reached, it will lock the account.
The following command can be used to change the default profile to allow an unlimited number of failed login attempt:
alter profile default limit FAILED_LOGIN_ATTEMPTS unlimited;
The following command can be used to change the default profile to allow an unlimited number of days as password lifetime.
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
[oracle@host1 log]$ dgmgrl / DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production Copyright (c) 2000, 2013, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. Connected as SYSDG. DGMGRL> show configuration Configuration – primdb1 Protection Mode: MaxPerformance Members: primdb1 - Primary database bcpdb1 - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS (status updated 7 seconds ago)
DGMGRL> show database verbose bcpdb1 Database - bcpdb1 Role: PHYSICAL STANDBY Intended State: APPLY-ON Transport Lag: 11 minutes (computed 0 seconds ago) Apply Lag: 0 seconds (computed 0 seconds ago) Average Apply Rate: 625.00 KByte/s Active Apply Rate: 523.00 KByte/s Maximum Apply Rate: 18.62 MByte/s Real Time Query: ON Instance(s): bcpdb1
Properties:
---------- ----------Binding = 'optional' ---------- ----------
DGMGRL> edit database bcpdb1 set property Binding='mandatory'; Property "binding" updated DGMGRL> exit
Read more
Configure Streaming Replication in PostgreSQL
Installation and configure Postgres 13 on RHEL
All about Physical Replication and Log shipping in Postgres
Possible ways to recover space from deleted rows with insufficient disk space
Streaming-Replication Sync and Async, benefits of streaming replication over Log-shipping
SQL:hostname_standby01:(MYPROD):PHYSICAL STANDBY> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APP L.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" 2 FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH, (SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) 3 IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ; Thread Last Sequence Received Last Sequence Applied Difference ---------- ---------------------- --------------------- ---------- 1 18223 17969 254 SQL:hostname_standby01:(MYPROD):PHYSICAL STANDBY>
hostname_standby01(oracle):MYPROD:trace$ tail -400f alert_MYPROD.log Errors in file /app/ora/local/admin/MYPROD/diag/rdbms/myprod_hostname_129/MYPROD/trace/MYPROD_pr0s_3151989.trc: ORA-00600: internal error code, arguments: [3020], [2], [16431], [8405039], [], [], [], [], [], [], [], [] ORA-10567: Redo is inconsistent with data block (file# 2, block# 16431, file offset is 134602752 bytes) ORA-10564: tablespace SYSAUX ORA-01110: data file 2: '+DATA01/myprod_hostname_129/datafile/sysaux.256.914736089' ORA-10561: block type 'TRANSACTION MANAGED DATA BLOCK', data object# 6478 Errors in file /app/ora/local/admin/MYPROD/diag/rdbms/myprod_hostname_129/MYPROD/trace/MYPROD_mrp0_3151683.trc (incident=17881):
RMAN> backup format '/db/dump01/backup_stdby/sysaux.256.914736089' datafile 2 ; Starting backup at 19-AUG-17 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=156 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00002 name=+DATA01/myprod_hostname_129/datafile/sysaux.257.914670317 channel ORA_DISK_1: starting piece 1 at 19-AUG-17 channel ORA_DISK_1: finished piece 1 at 19-AUG-17 piece handle=/db/files/backup_stdby/sysaux.256.914736089 tag=TAG20170219T103456 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 19-AUG-17 Starting Control File and SPFILE Autobackup at 19-AUG-17 piece handle=/app/ora/local/admin/MYPROD/files/PRIMARY_MYPROD_c-218898855-20170219-01.ctl comment=NONE Finished Control File and SPFILE Autobackup at 19-AUG-17 RMAN> exit
hostname_ standby01 (oracle):MYPROD:backup_stdby$ rman target / RMAN> catalog start with '/db/files/backup_stdby' ; using target database control file instead of recovery catalog searching for all files that match the pattern /db/files/backup_stdby List of Files Unknown to the Database ===================================== File Name: /db/files/backup_stdby/sysaux.256.914736089 Do you really want to catalog the above files (enter YES or NO)? YES cataloging files... cataloging done List of Cataloged Files ======================= File Name: /db/files/backup_stdby/sysaux.256.914736089 RMAN> exit SQL: hostname_ standby01:(MYPROD):PHYSICAL STANDBY> shut immediate ; ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL: hostname_ standby01:(MYPROD):PHYSICAL STANDBY> startup mount; ORACLE instance started. Total System Global Area 1068937216 bytes Fixed Size 2235208 bytes Variable Size 494929080 bytes Database Buffers 566231040 bytes Redo Buffers 5541888 bytes Database mounted. SQL: hostname_ standby01:(MYPRD):PHYSICAL STANDBY> !rman target / Recovery Manager: Release 11.2.0.3.0 - Production on Sun AUG 19 10:46:20 2017 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: MYPROD(DBID=218895632, not open) RMAN> restore datafile 2 ; Starting restore at 19-AUG-17 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=78 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00002 to +DATA01/myprod_files/datafile/sysaux.256.914736089 channel ORA_DISK_1: reading from backup piece /db/dump01/backup_stdby/sysaux.256.914736089 channel ORA_DISK_1: piece handle=/db/files/backup_stdby/sysaux.256.914736089 tag=TAG20170219T103456 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 19-AUG-17 RMAN> exit Recovery Manager complete.
SQL: hostname_ standby01:(MYPROD):PHYSICAL STANDBY> alter database recover managed standby database cancel ; Database altered. SQL: hostname_ standby01:(MYPROD):PHYSICAL STANDBY> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT; Database altered. Check if MRP is running now. All looks good.. ! J SQL: hostname_ standby01:(MYPROD):PHYSICAL STANDBY> !ps -ef|grep mrp oracle 3500966 1 0 10:47 ? 00:00:00 ora_mrp0_MYPROD oracle 3501928 3456846 0 10:48 pts/10 00:00:00 /bin/ksh -c ps -ef|grep mrp oracle 3501930 3501928 0 10:48 pts/10 00:00:00 grep mrp
SQL: hostname_ standby01:( MYPROD):PRIMARY> archive log list ; Database log mode Archive Mode Automatic archival Enabled Archive destination /app/ora/local/admin/myprod/arch1 Oldest online log sequence 18233 Next log sequence to archive 18235 Current log sequence 18235 SQL: hostname_ standby01:( MYPROD):PHYSICAL STANDBY> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH, (SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ; SQL:xstm6551bor:( MYPROD):PHYSICAL STANDBY> / Thread Last Sequence Received Last Sequence Applied Difference ---------- ---------------------- --------------------- ---------- 1 18234 18215 19 SQL:hostname_standby01:( MYPROD):PHYSICAL STANDBY> / Thread Last Sequence Received Last Sequence Applied Difference ---------- ---------------------- --------------------- ---------- 1 18234 18228 6 SQL:hostname_standby01:( MYPROD):PHYSICAL STANDBY> / Thread Last Sequence Received Last Sequence Applied Difference ---------- ---------------------- --------------------- ---------- 1 18234 18234 0 SQL: hostname_standby01:( MYPROD):PHYSICAL STANDBY> SQL: hostname_ standby01:(MYPROD):PHYSICAL STANDBY>
select to_char(begin_time,'MM-DD-YYYY HH24:MI') begin_time ,ssolderrcnt ORA_01555_cnt, nospaceerrcnt no_space_cnt ,txncount max_num_txns, maxquerylen max_query_len ,expiredblks blck_in_expired from v$undostat where begin_time > sysdate - 1 order by begin_time;
select sum(bytes)/1024/1024 cur_mb_size, dbms_undo_adv.required_undo_size(900) req_mb_size from dba_data_files where tablespace_name = (select value from v$parameter where name = 'undo tablespace');
SELECT d.undo_size/(1024*1024) "ACTUAL UNDO SIZE [MByte]", SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]", ROUND((d.undo_size / (to_number(f.value) * g.undo_block_per_sec))) "OPTIMAL UNDO RETENTION [Sec]" FROM ( SELECT SUM(a.bytes) undo_size FROM v$datafile a, v$tablespace b, dba_tablespaces c WHERE c.contents = 'UNDO' AND c.status = 'ONLINE' AND b.name = c.tablespace_name AND a.ts# = b.ts#) d, v$parameter e, v$parameter f, ( SELECT MAX(undoblks/((end_time-begin_time)*3600*24)) undo_block_per_sec FROM v$undostat) g WHERE e.name = 'undo_retention' AND f.name = 'db_block_size' /
select s.sid, s.serial#, s.osuser, s.logon_time ,s.status, s.machine ,t.used_ublk, t.used_ublk*16384/1024/1024 undo_usage_mb from v$session s ,v$transaction t where t.addr = s.taddr;
select s.sid, s.serial#, s.osuser, s.logon_time, s.status ,s.machine, t.used_ublk , t.used_ublk*16384/1024/1024 undo_usage_mb ,q.sql_text from v$session s, v$transaction t ,v$sql q where t.addr = s.taddr and s.sql_id = q.sql_id;