This blog contains experience gained over the years of implementing (and de-implementing) large scale IT applications/software.

HowTo: Use Oracle BBED to adjust DB Name in File Headers

HowTo: Use BBED to hack the database SID in the datafiles if you’ve gone and got them all mixed during a “CREATE CONTROLFILE” operation.

WARNING: Using BBED is not supoprted by Oracle unless you are asked to use it by Oracle Support themselves.

Use UNIX vi to create a text file that contains a line number, followed by the file name for the DB files that need changing:

# cat <<EOF > filelist.txt
1 /db/ora/system/system1.dbf
2 /db/ora/data1/data1.dbf
3 /db/ora/index1/index1.dbf
EOF

Save the file as “filelist.txt”.

Launch bbed (blockedit) as the Oracle DB UNIX owner.
Change the text “NEWID” for your new DB name in the “modify” line below.

$ bbed
BBED> set listfile 'filelist.txt'
BBED> set mode edit

# Dump the current block value for datafile #1 in your list file.
# exmaple: BBED> dump /v dba <file#>,<block> …

BBED> dump /v dba 1,1 offset 32 count 16

Make the swap:

BBED> modify /c NEWID file 1 block 1 offset 32

The checksum is now invalid:

BBED> sum file 1 block 1

Force save the new checksum:

BBED> sum file 1 block 1 apply

Verify the block:

BBED> verify file 1 block 1

Once you’ve done all your files:

BBED> quit;

Start the database with the CREATE CONTROLFILE SET DATABASE “NEWID”…


3 thoughts on HowTo: Use Oracle BBED to adjust DB Name in File Headers

  1. Your modify /c NEWID will not work if you try to do something like change your database headers from NEWID33 to NEWID. It will only modify the bytes that make up the NEWID part and not change the 33. The better way to do this is to just convert to your new DB name to hex and then write the hex to the header.

    # Database name is OCPSQL33
    BBED> dump /v offset 32
    File: /u01/oradata/0jtjrvf5 (0)
    Block: 1 Offsets: 32 to 47 Dba:0x00000000
    ——————————————————-
    4f435053 514c3333 01000000 00770100 l OCPSQL33…..w..

    <16 bytes per line>

    #try to change it to just OCP
    BBED> modify /c OCP block 1 offset 32;
    File: /u01/oradata/0jtjrvf5 (0)
    Block: 1 Offsets: 32 to 47 Dba:0x00000000
    ————————————————————————
    4f435053 514c3333 01000000 00770100

    <32 bytes per line>

    # Still shows as OCPSQL33
    BBED> dump /v block 1 offset 32
    File: /u01/oradata/0jtjrvf5 (0)
    Block: 1 Offsets: 32 to 47 Dba:0x00000000
    ——————————————————-
    4f435053 514c3333 01000000 00770100 l OCPSQL33…..w..

    <16 bytes per line>

  2. Very true.
    From memory this post was created based on a requirement to rename an SAP Oracle database.
    SAP Oracle databases only have 3 characters, so the replacement works perfectly.
    But thanks for the correction/note.

Add Your Comment

* Indicates Required Field

Your email address will not be published.

*