28.2.24

Little endian and Big endian in oracle with example

 A big-endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest. A little-endian system, in contrast, stores the least significant byte at the smallest address.

Let's consider an example to demonstrate the concept of little endian and big endian in the context of an Oracle database. Imagine we have a table in an Oracle database that stores a 4-byte integer value. Let's call this table "ExampleTable" and the column "Value".


Little Endian:

In little-endian byte ordering, the least significant byte (LSB) is stored first, followed by the more significant bytes. So, if the integer value is 0x12345678, it would be stored in memory in the following byte order:

Address   |    Byte Value

------------------------

0x1000    |       0x78

0x1001    |       0x56

0x1002    |       0x34

0x1003    |       0x12


Big Endian:

In big-endian byte ordering, the most significant byte (MSB) is stored first, followed by the less significant bytes. So, if the integer value is 0x12345678, it would be stored in memory in the following byte order:

Address   |    Byte Value

------------------------

0x1000    |       0x12

0x1001    |       0x34

0x1002    |       0x56

0x1003    |       0x78


When working with Oracle, the byte order is typically determined by the underlying hardware architecture of the system. Oracle handles byte ordering transparently for most operations, so you don't usually need to worry about it explicitly.


However, if you need to handle byte ordering explicitly in your code, Oracle provides functions to convert between little endian and big endian byte orders. For example, you can use the TO_NUMBER function with the appropriate format model to convert a little-endian binary string to a number in Oracle.


Here's an example of converting a little-endian binary string to a number in Oracle:

SELECT TO_NUMBER('78563412', 'XXXXXXXX', 'NLS_NUMERIC_CHARACTERS=''.,''') AS ConvertedValue FROM DUAL;


In this example, '78563412' represents the little-endian binary string, and 'XXXXXXXX' is the format model specifying the byte order. The NLS_NUMERIC_CHARACTERS=''.,'' parameter ensures that the decimal separator is set correctly.


The result would be 2018915346, which is the decimal representation of the little-endian binary value 0x12345678.


Similarly, you can use other conversion functions like TO_CHAR or RAWTOHEX to convert values between little endian and big endian byte orders as needed.


Keep in mind that in most cases, you don't need to explicitly handle byte ordering when working with Oracle databases, as the database engine takes care of it automatically

21.2.24

ORA-48132: requested file lock is busy, [HM_RUN]

Alert log reports the below error in alert.log 

Errors in file D:\ORACLE\APP\ORACLE\diag\rdbms\***\***\trace\*****_ora_18656.trc:

ORA-48132: requested file lock is busy, [HM_RUN] [D:\ORACLE\APP\ORACLE\diag\rdbms\***\***\lck\AM_1618_3044626670.lck]


It's during the RMAN backups are running.

When the RMAN backup is run querying the below output shows RMAN is Waiting on "ADR file lock" wait event


Select inst_id, sid, CLIENT_INFO ch, seq#, event, state, seconds_in_wait secs from gv$session where program like '%RMAN%' and wait_time = 0 and not action is null;


RMAN is acquiring ADR lock and this Lock is not released by OS and hence the error in the Alert log. 


To Fix 

To prevent the error message from getting reported in Alert log you can include the below event in the Rman backups script


Rman>


run {sql "alter system set events ''logon trace name krb_options level 20''";

sql "alter session set max_dump_file_size=''5K''";

allocate channel t1 <sbt or disk channel> ;

allocate channel t2 <sbt or disk channel> ;

sql "alter system set events ''logon trace name krb_options off''";

release channel t1;

release channel t2;

}


20.2.24

Streams aq waiting for time management or cleanup tasks

 In the Oracle Database, "Streams AQ" refers to the Advanced Queuing feature of Oracle Streams. It is a queuing mechanism that allows asynchronous communication between different components of a database or even between different databases.


When you see the message "Streams AQ waiting for time management or cleanup tasks," it typically means that there are pending administrative tasks related to the management and cleanup of the Advanced Queuing system. These tasks are usually performed by the Oracle Streams background processes.


To address this situation, you can follow these steps:


Identify the Streams Administrator: Determine the user who has the necessary privileges to perform administrative tasks on the Streams AQ system. This user is typically referred to as the "Streams Administrator."


Connect as the Streams Administrator: Use an Oracle client tool or command-line interface to connect to the database as the Streams Administrator.


Perform necessary cleanup tasks: Execute the appropriate administrative commands to perform the required cleanup tasks. For example, you might need to purge old or expired messages from the queues, remove unused queues, or perform other maintenance operations.


Monitor the Streams AQ system: After performing the cleanup tasks, monitor the system to ensure that the waiting time management or cleanup tasks have been resolved. You can use Oracle Enterprise Manager or other monitoring tools to check the status and health of the Advanced Queuing components.


It's important to note that the specific commands and steps may vary depending on your Oracle Database version and configuration. Therefore, it's recommended to consult the Oracle documentation or seek assistance from your database administrator for detailed guidance.

19.2.24

Essential Crosscheck Commands for RMAN Backup Management

Backup management is a critical aspect of maintaining data integrity and ensuring disaster recovery capabilities. In Oracle Recovery Manager (RMAN), the crosscheck commands play a vital role in validating and managing backups. In this blog post, we will explore the essential crosscheck commands and their usage to maintain the reliability of your backup infrastructure.


Crosscheck all backups:

To verify the integrity and existence of all backups, you can use the following command:

RMAN> CROSSCHECK BACKUP;


List expired backups:

To identify any expired backups detected during the crosscheck process, execute the following command:

RMAN> LIST EXPIRED BACKUP;


Delete expired backups:

To remove the expired backups identified during the crosscheck, use the following command:

RMAN> DELETE EXPIRED BACKUP;


Crosscheck all archive logs:

To validate the status of all archived logs, use the following command:

RMAN> CROSSCHECK ARCHIVELOG ALL;


List expired archive logs:

To obtain a list of expired archive logs detected during the crosscheck, execute the following command:

RMAN> LIST EXPIRED ARCHIVELOG ALL;


Delete expired archive logs:

To delete the expired archive logs identified during the crosscheck, use the following command:

RMAN> DELETE EXPIRED ARCHIVELOG ALL;


Crosscheck all datafile image copies:

To verify the integrity of all datafile image copies, use the following command:

RMAN> CROSSCHECK DATAFILECOPY ALL;


List expired datafile copies:

To list the expired datafile copies detected during the crosscheck, execute the following command:

RMAN> LIST EXPIRED DATAFILECOPY ALL;


Delete expired datafile copies:

To remove the expired datafile copies identified during the crosscheck, use the following command:

RMAN> DELETE EXPIRED DATAFILECOPY ALL;


Crosscheck backups of a specific tablespace:

To verify the backups of a particular tablespace, use the following command:

RMAN> CROSSCHECK BACKUP OF TABLESPACE USERS;


List expired backups of a specific tablespace:

To list the expired backups of a specific tablespace detected during the crosscheck, execute the following command:

RMAN> LIST EXPIRED BACKUP OF TABLESPACE USERS;


Delete expired backups of a specific tablespace:

To delete the expired backups of a specific tablespace identified during the crosscheck, use the following command:

RMAN> DELETE EXPIRED BACKUP OF TABLESPACE USERS;


Conclusion:

Regularly performing crosscheck operations using RMAN commands is crucial for maintaining the integrity of your backup environment. By verifying and managing the backups, archive logs, and datafile copies, you ensure that your data recovery capabilities are reliable and up-to-date. Incorporate these essential crosscheck commands into your backup management routine to enhance the overall resilience of your Oracle database.