Wednesday, May 31, 2023
ASM Queries
Tuesday, May 2, 2023
Migration
Migration
can you try this :
datafile '+p1rac1d4_oradata' size 20g
logging
online
permanent
blocksize 8192
extent management local autoallocate
default nocompress
segment space management auto;
Saturday, March 18, 2023
important points
- Originally the UTLBSTAT/UTLESTAT scripts were used to monitor performance metrics. Oracle 8i introduced the Statspack functionality which Oracle 9i extended. In Oracle 10g statspack has evolved into the Automatic Workload Repository (AWR).
- Oracle 10g took code instrumentation in the kernel to a whole new level with the introduction of the Automatic Workload Repository (AWR) and Active Session History (ASH) features. Oracle 11g takes that further with options such as the Automatic Diagnostic Repository (ADR) and the SQL Performance Analyzer (SPA).
- In Oracle database 11g, a new facility, the ADR, was added. As part of this new facility, there’s a new V$ view—V$DIAG_INFO.
- select * from v$diag_info;
- Starting in Oracle database 11g, The ADRCI tool allows you to review “problems” (critical errors in the database) and incidents (occurrences of those critical errors) and to package them up for transmission to support
adrci> show tracefile -I 6177
This shows me the location of the trace file for incident number 6177. Further, I can see a lot of detail about the incident if I so choose:
adrci> show incident -mode detail -p "incident_id=6177" - Automatic Storage Management (ASM): This is a new feature of Oracle 10g Release1 (for both Standard and Enterprise editions).
- Oracle 11g Release 2, ASM provides not only this database file system but optionally a clustered file system as well, which is described next.
- This feature of multiple block sizes was introduced for the purpose of making transportable tablespaces usable in more cases.
- Tablespaces with multiple block sizes should be used to facilitate transporting tablespaces; they are not generally used for anything else.
- The change-tracking file is a new, optional file for use with Oracle 10g Enterprise Edition and above
- Flashback logs were introduced in Oracle 10g in support of the FLASHBACK DATABASE command
- The Data Pump format is exclusive to Oracle 10g Release 1 and above—it did not exist in any Oracle9i release, nor can it be used with that release.
- PGA_AGGREGATE_TARGET: This parameter controls how much memory the instance should allocate, in total, for all work areas used to sort or hash data.
select sum(bytes) from v$sgastat where pool = 'shared pool';
The sharedpool holds many other structures that are outside the scope of the corresponding parameter. The SHARED_POOL_SIZE is typically the largest contributor to the shared pool as reported by the SUM(BYTES), but it is not the only contributor.
In Oracle 10g, the SHARED_POOL_SIZE parameter controls the size of the shared pool, whereas in Oracle9i and before, it was just the largest contributor to the shared pool. You should review your 9i and before actual shared pool size (based on V$SGASTAT) and use that figure to set your SHARED_POOL_SIZE parameter in Oracle 10g and above.
When someone complains of deadlocks in the database, I have them run a script that finds unindexed foreign keys; 99 percent of the time we locate an offending table. By simply indexing that foreign key, the deadlocks—and lots of other contention issues—go away.
The number one cause of deadlocks in the Oracle database, in my experience, is unindexed foreign keys. (Thenumber two cause is bitmap indexes on tables subject to concurrent updates, which we’ll cover in Chapter 11).
The higher the transaction isolation level, the locking overhead can increase while user concurrency can decrease.
GRANT execute ON dbms_monitor TO scott;
- What happens when you run an UPDATE
statement, as follows, and while that statement is running, someone updates a row it has yet to read from Y=5 to Y=6
and commits?
Update t Set x = 2 Where y = 5; - So, why are constraints validated after the SQL statement executes? Why not during? This is because it is very natural for a single statement to make individual rows in a table momentarily inconsistent.
- we also have the ability to defer constraint checking, which can be quite advantageous forvarious operations. The one that immediately jumps to mind is the requirement to cascade an UPDATE of a primary key to the child keys.
- Page:290 : the bottom line is, only use deferrable constraints where you have an identified need to use them. They introduce subtle side effects that could cause differences in your physical implementation (non-unique vs. unique indexes) or in your query plans
- With the single UPDATE statement, we just reissue theUPDATE. We know that it will entirely succeed or entirely fail; there will not be partial work to worry about.
- My final words on bad transaction habits concern the one that arises from using the popular programming APIs ODBC and JDBC. These APIs “autocommit” by default.
- Every Oracle database has at least two online redo log groups with at least a single member (redo log file) in each group.
- Those two things together—that the segment was actually created by the INSERT but not “uncreated” by the ROLLBACK, and that the new formatted blocks created by the INSERT were scanned the second time around—show that a rollback is a logical “put the database back the way it was” operation. The database will not be exactly the way it was, just logically the same.
Thursday, March 9, 2023
RMAN Backup status
Tuesday, September 6, 2022
Oracle ASM
Column HOT_USED_MB & COLD_USED_MB in V$ASM_DISKGROUP
HOT_USED_MB
Number of used megabytes in the hot region
COLD_USED_MB
Number of used megabytes in the cold region alter diskgroup dg1 add template hot_files attributes (hot) / Diskgroup altered. Once the template is created, you can use it to create the datafiles using that template:
create tablespace hot_ts datafile '+DATA(hot_files)/hot_ts_01.dbf' size 1M / in a disk, the outer part have greater performance than the inner part. ---imagine a disk as your DVD or CD.
outer parts are called hot region and inner parts are called cold region.
oracle give you the flexibility to be able to place files in either hot or cold region. IF the geometry is not mask from ASM instance.
Thursday, August 25, 2022
Tablespace monitoring
Monday, August 22, 2022
Testing data
IS
/* this procedure inserts N records into RTABLE */
V INTEGER;
BEGIN
-- get the maximum ID from the table
SELECT MAX(RID) INTO V FROM RTABLE;
FOR I IN 1..N LOOP
INSERT INTO RTABLE (RID, NOTES) VALUES(I, 'record ' || TO_CHAR(I));
-- end the transactions every 5 inserts
IF MOD(I,5)=0 THEN
COMMIT;
END IF;
END LOOP;
COMMIT;
END POPULATE_RTABLE;
/
Friday, March 11, 2022
Oracle Golden Gate
Golden gate daily hits
-- in ggsrv1:
send extract esrv1 getparaminfo
-- in ggsrv2:
send replicat rsrv2 getparaminfo
GGSCI (ggsrv1.localdomain as ogg@db1) 15> lag extract esrv1
Sending GETLAG request to EXTRACT ESRV1 ...
Last record lag 2 seconds.
At EOF, no more records to process.
To verify that all the tables included in your replication have primary key constraints.
from DBA_TABLES t
where not exists (select 1
from DBA_CONSTRAINTS c
where c.OWNER = t.OWNER and c.TABLE_NAME = t.TABLE_NAME
and c.CONSTRAINT_TYPE = 'P')
and t.OWNER='HR';
Wednesday, February 9, 2022
db_validation
db_validation
Thursday, January 27, 2022
Changing dataguard mode
Changing Dataguard mode from Maximum performance mode to maximum availability
Friday, January 7, 2022
what happens at DR side if space is exhausted during tablespace creation at primary side
FIG project queries
##### Service add & LOad Baclancing on Add Service ####### srvctl add service -s wcccdmt.farmersinsurance.com -r wcccdmtx1,wcccdmtx2,wcc...
-
set linesize 180 select b.db_unique_name, a.tablespace_name ,sum(a.tots)/1024/1024/1024 "Total Size(GB)" ...
-
ORA-00742: Log read detects lost write in thread 1 sequence 104 block 30681 You can encounter this error if your Oracle Database machine wa...