Corrpt Label; wrong magic number
I got a Sun unit "Ultra Enterprise 2" to be installed with Solaris 10. What I have just done were:
1. Successful boot of the machine
OK >
2. Probe all scsi devices
OK> probe-scsi-all
3. All scsi devices were probed.
MAG3091L ===== inserted in D1000 storage
ST39103LC ===== inserted in D1000 storage
DDRS39130 ===== inserted in D1000 storage
ST39102LC ===== Local Drive
Toshiba xxxx ===== Removable Read Device
4. Start to install from CD rom
OK> boot cdrom - nowin
then during the probing a Warning prompted:
WARNING: /sbus1f, 0/QLGC, isp@0,10000 /sd@a,0 (sd24)
Corrpt Label; wrong magic number
What should be the fix for this, I am certain that this has something to do with the D1000 storedge but am not sure how to deal with this. I hope somebody would help.
Many thanks
Petalio
Well, I found my problem. I think many people are having the same issues. The problem was with my DVD. I had to install the new firmware. My DVD is a Toshiba DVD-ROM SD-M1401. The firware was 1007. The new level is 1009. For the patch and more information please look at
http://sunsolve.sun.com/search/advsearch.do?collection=PATCH&type=collections&queryKey5=111649&toDocument=yes
Similar Messages
-
Corrupt label, wrong magic number
Hi guys,
I have a problem I have 2 ultra 60 with disk array D1000. The problem is usually I turn off my disk array now last time I turned off my disk array after turning back Solaris doesn't recognized disks in disk array. I tried to relabel all disks in disk array by using format command but it " gives corrupt label,wrong magic number " . So could you please tell me solution.
Thanks in advanceThe disk is probably just fine - it just doesn't have a Solaris vtoc (label) on it for some reason.
Did you get the disk from another source (taken from an old array or something similar)?
I'm surprised that the solaris install doesn't give you an option to place a label on the disk.
Next time the install exits, try running 'format'
This will give you a list of the internal disks (and external ones if you've got any additional HBAs and storage attached)
You'll see at least 1 with the string like:
c10t600A0B800026A8600000018F46B9783Ed0: configured with capacity of xxxxx(naturally, the actual c.t.d. string will be different on your system)
Find the corresponding disk in the list that follows and select it by number...
c10t600A0B800026A8600000018F46B9783Ed0: configured with capacity of 4.00GB
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@8,600000/SUNW,qlc@2/fp@0,0/ssd@w21000000870fc5e9,0
1. c1t2d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@8,600000/SUNW,qlc@2/fp@0,0/ssd@w21000000870efd67,0
2. c1t4d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@8,600000/SUNW,qlc@2/fp@0,0/ssd@w21000000870e6669,0
3. c10t600A0B800026A8600000018F46B9783Ed0 <SUN-CSM200_R-0619 cyl 2046 alt 2 hd 64 sec 64>
/scsi_vhci/ssd@g600a0b800026a8600000018f46b9783e
4. c10t600A0B8000266666000026AF46B6C7DFd0 <SUN-CSM200_R-0619 cyl 38398 alt 2 hd 256 sec 64>
/scsi_vhci/ssd@g600a0b8000266666000026af46b6c7df
Specify disk (enter its number): 3
selecting c10t600A0B800026A8600000018F46B9783Ed0
[disk formatted]
Disk not labeled. Label it now? Answer yes to this and next time the install should continue.
Remember that you'll lose anything that was on this disk prior to the labelling (if anything) so make sure you're really wanting to do this before you try this on your system. -
New install on new drive - Corrupt label - wrong magic number
Hi,
I put a new 120GB Seagate drive in my Sun Blade 100, and installed Solaris 9 9/05. But, every time I boot, I see a WARNING msg:
WARNING: .... (dad0)
corrupt label - wrong magic number
I installed from the 1st software CD, as I've done many times before, but this is the 1st time I've done an installation on a new, non-Sun hard drive, so from what I can tell, I need to do something additional to prevent having this warning, but I can't figure out what.
I've tried "boot cdrom -s" and then format -> partition, and I can see that the swap and backup slices had started in cylinder 0. From what I've read, that's a problem, so I changed swap to start in cylinder 1.
Here's what format->part->print looks like now:
partition> pri
Volume: abc
Current partition table (original):
Total disk cylinders available: 57459 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 2008 - 52437 98.11GB (50430/0/0) 205754400
1 swap wu 1 - 2010 3.91GB (2010/0/0) 8200800
2 backup wm 0 - 57458 111.79GB (57459/0/0) 234432720
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 home wm 52438 - 57457 9.77GB (5020/0/0) 20481600
And, here's "prtvtoc /dev/rdsk/c0t0d0s0:
# prtvtoc /dev/rdsk/c0t0d0s0
* /dev/rdsk/c0t0d0s0 (volume "abc") partition map
* Dimensions:
* 512 bytes/sector
* 255 sectors/track
* 16 tracks/cylinder
* 4080 sectors/cylinder
* 57461 cylinders
* 57459 accessible cylinders
* Flags:
* 1: unmountable
* 10: read-only
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 0 4080 4079
* 8204880 18446744073709539376 8192639
* 234428640 4080 234432719
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 8192640 205754400 213947039 /
1 3 01 4080 8200800 8204879
2 5 00 0 234432720 234432719
7 8 00 213947040 20481600 234428639 /export/home
Can anyone tell me what I need to do to eliminate the problem?
Also, I don't mind doing a complete new installation, but I'd like to know what I SHOULD have done during the installation to avoid this problem.
Thanks,
JimHi,
I think that I fixed the swap ending cylinder, but I'm still getting the same warning when I boot the system. Here's the new format->partition->print:
partition> print
Volume: abc
Current partition table (original):
Total disk cylinders available: 57459 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 2008 - 52437 98.11GB (50430/0/0) 205754400
1 swap wu 1 - 2007 3.90GB (2007/0/0) 8188560
2 backup wm 0 - 57458 111.79GB (57459/0/0) 234432720
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 home wm 52438 - 57457 9.77GB (5020/0/0) 20481600
What else can I do to try to eliminate this warning?
Thanks,
Jim -
Corrupted label /wrong magic number
Hi!
I found this forum is very helpful, and post my problem on the list. Any idea is highly apprecaited!
I'm a new comer on Solaris OS. I tried to install a new SCSI (StorEdge unipack) to my sun station 10. After I connected it to the old HD, and reboot the system, the system shows:unbootable device..., then I type reboot, but the system seems freezed, so I turn off the electricity for the system (Very wrong). Afterwards, I disconnect the new SCSI, and boot again. The system boot normally, and runs ok, except one of my partition is not read, and error message shows: corrupted label /wrong magic number. Is my data on that partition got lost? how can I recover?
Thanks a lot
TigerWhen you attempt to hook up your external UniPack again make sure it has a unique SCSI target ID.
If you run format, without the external disk, you should probably see c0t3d0 and c0t0d0, for example, for your 2 internal disks. c0t6 will be used for internal CDROM, if it exists. You should probably make the external disk ID 1 or 2 (pick one that is not seen in format) with switch in back of UniPack.
boot -r should build path for new disk. -
Nexenta Solaris Release 5.11 problem with wrong magic number
I built an x86 server using nexenta. The box got powered down, and now it's freaking out about the /var filesystem.
Unable to repair /var filesystem.
fsck -F ufs /dev/rdsk/c0d0s4
I run fsck -F ufs /dev/rdsk/c0d0s4 on it.
and get Bad Superblock at block 16: Number of directories out of range.
Look for Alternate Superblocks with mkfs
Then I noticed I didn't use -y
use -y and it fails with Fsck was running in yes mode. If you wish to run in yes mode using the alternate superblock run
fsck -y -o b=20350880 /dev/rdsk/c0d0s4
So then ran fsck via fsck -y -o -b=20350880 /dev/rdsk/c0d0s4
then I get Bad SuperBlock at 20350880: Magic number wrong.
Any help would be greatly appreciated.
Thanks MarkSo then ran fsck via fsck -y -o -b=20350880 /dev/rdsk/c0d0s4how about:
fsck -y -o -b=32 /dev/rdsk/c0d0s4
man newfs for the option to NOT create the filesystem but runs the command anyway and shows you the alternate boot blocks.
alan -
Sun Ultra 25 - Bad magic number in disk label
I have a Sun Ultra 25 SPARC that is booting fine to it's 80GB SATA drive. Solaris 10, OpenBoot 4.22.19.
Here's what I did:
I installed a 2TB Western Digital SATA drive into the HDD1 slot.
I formatted the disk in the HDD1 slot via the format command, labeled the disk, and divided it into partitions.
I then used newfs to build the ufs on all partitions.
I mirrored the disk in HDD0 to the disk in HDD1 using ufsdump for all partitions. The data is accessible and looks ok.
After this was done I did an installboot to /dev/rdsk/c1t1d0s0 (the / partition of the HDD1 slot).
I then did a fsck on every partition to verify that they are okay.
I then took the hard drive in HDD1 and put it in the HDD0 slot, now wanting to boot off that disk.
At the reboot:
Bad magic number in disk label
Can't open disk label package
If I do a probe-scsi:
MPT Version 1.05, Firmware Version 1.08.03.00
Target 0
Unit 0 Disk ATA WDC WD20EADS-00R0A01 3907029168 Bocks, 2000 GB SATA device PhyNum 0
As far as I can tell disk0 is the correct devalias which is:
/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/disk@0,0
I just don't understand how the fsck is okay, but the boot give bad magic number in disk label?
The 80GB drive in HDD slot 0 works fine with the boot disk0 command, all I'm doing is swapping a larger disk with the same data for the smaller disk.if it is like any other Sun product, it needs to go through the format command and get a volname.... it is just a label, but it needs to be done.
haroldkarl -
Bad Magic Number in Disk Label & DiskSuite
Envrionment:
E450
Solaris 8
DiskSuite 4.2.1
16 disks
Because of a power failure, after reboot one of the disks has bad magic number in its disk label. The slice was in a mirror. DiskSuite has hot spares and one of them took over the failed slice. I am trying to figure out how to get it back to where it was.
I think I should use 'format' to recover the disk label from the backup label. However, once the label is recovered, how do I make it stop using the hotspare and have the failed slice join back to the mirror?
Sorry if this is basic question, I am relatively new to Sun/Solaris and I just took over the E450.
Thanks,Envrionment:
E450
Solaris 8
DiskSuite 4.2.1
16 disks
Because of a power failure, after reboot one of the
disks has bad magic number in its disk label. The
slice was in a mirror. DiskSuite has hot spares and
one of them took over the failed slice. I am trying to
figure out how to get it back to where it was.
I think I should use 'format' to recover the disk
label from the backup label. However, once the label
is recovered, how do I make it stop using the hotspare
and have the failed slice join back to the mirror?
Sorry if this is basic question, I am relatively new
to Sun/Solaris and I just took over the E450.
Thanks,Since the host spare took over then you're free to repair/replace the bad drive. In this case you could check the drive using format and partition to view the partitions. If the label is bad then I would suspect the drive is still good and a simple format>label and save command would repair the label. Then once this is done if all goes well then the system should rebuild the drive and the hot spare will not longer be used. The system should regonize the drive as a replacement and rebuild it then stop using the hot spare.
Michael -
Trying to update OBP getting unrecognized magic number in media label
Two questions both relating to my trying to update my OBP:
1. when I typebanner I get ... AXi (UltraSPARC-IIi), PS/2 keyboard
OpenBoot 3.10.12 SME...
but when I type .version I get OBP 3.10.12
My question is which OBP update to use, AXi OBP 3.10.13 or OBP 3.10.31?
2. When I try to install either I always get the same thing
I copied the .Floppy file to a floppy
then type boot floppy nolabel just like the readme and I get this:
Unrecognized magic number in media label
Can't open disk label package
Can't open boot deviceI have also tried coping the program file to a cd and tyring boot cdrom nolabel but same results
Any ideas?
ThanksHello,
because the DTK boards don't support faster CPUs than 333MHz, this is a Sun board.
I was unable to locate the SPARCengine Ultra AXi OEM Service Manual, the file was finally removed. This is an alternate link
http://www.zmicro.com/download/sun-axi.pdf
The Solaris 10 media kits are only available with DVD media, but you can download the CD images. The Solaris documentation is available online
http://docs.sun.com/app/docs/prod/solaris.10?l=en
I would strongly recommend that you give Solaris 10 a try !
You might try Aurora Linux. The Ultrax AXi is among the supported systems. Linux for SPARC capabilities are behind the x86/x64 versions.
This is the link to the project page
http://auroralinux.org/
Aurora SPARC Linux Wiki
http://wiki.auroralinux.net/wiki/
Michael -
T6340 cannot boot disk - Bad magic number in disk label
Hi,
I have a shiny new T6340 that I am just setting up.
When I get through the CMM to the SP and onto the EEPROM,
I then try to start the boot process:
{0} ok boot disk1
Sun Blade T6340 Server Module, No Keyboard
Copyright 2009 Sun Microsystems, Inc. All rights reserved.
OpenBoot 4.30.4, 130848 MB memory available, Serial #76313344.
Ethernet address 0:14:4f:8c:73:0, Host ID: 848c7300.
Boot device: /pci@500/pci@0/pci@9/@0/disk@1 File and args:
Bad magic number in disk label
Can't open disk label package
ERROR: boot-read fail
Evaluating:
Can't open boot device
{0} ok show-disks
a) /pci@500/pci@0/pci@9/LSILogic,sas@0/disk
b) /pci@500/pci@0/pci@2/pci@0/usb@0,2/storage@5/disk
c) /pci@500/pci@0/pci@2/pci@0/usb@0,2/storage@1/disk
q) NO SELECTION
Enter Selection, q to quit: q
{0} ok boot /pci@500/pci@0/pci@9/LSILogic,sas@0/disk
Boot device: /pci@500/pci@0/pci@9/LSILogic,sas@0/disk File and args:
Bad magic number in disk label
Can't open disk label package
ERROR: boot-read fail
Can't open boot device
{0} ok This is a brand new B6000 system and has not been booted before.
Please tell me what I need to do to enable the disks, so I can do the next bit!
rachel@rachel,
In your original post you showed a screen capture of what you tried.
First you typed "boot disk1". ( Why disk1? Why not disk0?)
When that didn't seem to work, you displayed the disks recognized by the system at OpenBoot.
The first of those disks was a device path of
/pci@500/pci@0/pci@9/LSILogic,sas@0/disk{code}
and so you attempted to boot from that but omitted whatever slice might be the boot slice of a factory preinstalled OS. For example...
{code:java}
boot /pci@500/pci@0/pci@9/LSILogic,sas@0/disk@0,0{code}
(just guessing at what could be that bootable slice).
What happens if you simply type "*boot*" when you are at OBP? -
Reformat external hard drive - "bad superblock", "magic number wrong" error
i was just given a brand new 300GB USB hard drive, however, as it came NTFS-formatted, immediately after plugging it in for the first time, i fired up Disk Utility, and attempted to format it with UFS.
The problem arose when the progress bar just sat there for an hour at a constant 5%. Assuming the program had stalled (it hadn't...though it would have sat there indefinitely), i quit Disk Utility, opened it back up, and again attempted to format the drive--only this time, almost immediately the program output:
BAD SUPER BLOCK: MAGIC NUMBER WRONG
LOOK FOR ALTERNATE SUPERBLOCKS? yes
SEARCH FOR ALTERNATE SUPER-BLOCK FAILED. YOU MUST USE THE
-b OPTION TO FSCK TO SPECIFY THE LOCATION OF AN ALTERNATE
SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck(8).
i opened up Terminal and tried manually to find an alternate superblock, to no avail.
fsck -b32 /dev/disk2s3
i've been unable to find any solutions to this issue online, but i'd really like to use my drive i've heard that this problem has to do with hardware that's about to fail, however, this is a brand new drive, and i'm quite certain the error is as a result of the aborted reformat operation.
Does anyone know how to remedy this? Thanks in advance.Hello TheRedWino, and a warm welcome to the forums!
Hmmm, what kind of Case/Chipset does it have?
Have you tried erasing it with Zeros one Pass?
"Disk Utility
1. Insert the Mac OS X Install disc that came with your computer, then restart the computer while holding the C key.
2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu. (In Mac OS X 10.4 or later, you must select your language first.)
Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.
3. Click the Erase tab.
4. Click the disclosure triangle to the left of the hard drive icon to display the names of your hard disk volumes and partitions.
5. Select your Mac OS X volume, then choose MacOS Extended Journalled, select the Partition tab.
6. Click Erase & look for Security Options. choose Zero 1 pass."
Formatting & Partitioning a Hard Drive in OS X - Tiger and Leopard...
http://www.kenstone.net/fcphomepage/partitioningtiger.html -
BAD SUPER BLOCK: MAGIC NUMBER WRONG
My Mac mini started playing up a couple of weeks ago, I thought it was the attached firewire drives, but it looks like a problem on the hard disk. I've been trying to fix this and I need help!
- I tried to restore leopard - only to find my leopard install disc is corrupt. I tried to make a copy with toast, but that failed, a couple of times
- So I've tried to use disk utility. I try to repair the volume. It gets to 'Checking Catalog file'. Then it gives the messages:
Invalid Key length
Volume check failed
Eror: Filesystem verify or repair failed.
- Then, booting from another leopard disk (for another machine, so I can't install from it), I've been running fsck. It says it can't the superblock, when I make suggestions I get the above message 'Bad super block': magic number wrong'. Any idea where there might be another valid copy of the superblock?
So, I'm a bit stuck. It's really annoying that the leopard disk that I bought doesn't copy and doesn't install.
Any suggestions gratefully received!How to Make a Non-Commercial DVD copy of MAC OS X Leopard
Making a DVD Image
Step1. Insert the retail Mac OS X Install DVD into your drive.
Step 2. Launch Disk Utility (Applications > Utilities).
Step 3. In Disk Utility, you will notice a white pane on the left hand side. In the pane, select the Mac OS X Install DVD by clicking on it once.
Step 4. Click New Image on the Disk Utility toolbar.
Step 5. A dialog box will appear. Give the new image a name. I used 'Mac OS X Install DVD'. Select the destination where you wish to save it. Leave Image Format at Compressed (default) and Encryption at None (default).
Step 6. Click Save to begin creating the image.
Step 7. Once your image has been created DO NOT mount it. Leave the image alone and proceed to the next section.
Burning the Image
Step 1. Launch Disk Utility (Applications > Utilities).
Step 2. Click Burn on the Disk Utility toolbar (upper left).
Step 3. Navigate to where you saved the DVD image created in the previous section. Click on the image file, then click the Burn button. Do not drag and drop the image file into Disk Utility during this step.
Step4. Insert a DVD when prompted and proceed to Burn it. (use good quality media) Using these exact steps I was successfully able to create a personal backup copy of Mac OS X Leopard. I hope this tutorial helps. -
Fsck: "Bad super block: magic number wrong"
One of my 750 Gig FireWire drives behaves peculiarly, all the files stopped opening on it. Disk Utility doesn't see anything wrong, DiskWarrior 4 didn't fix the HD's behavior, DataRescue II was willing to rescue files... but 750 Gigs' worth? Who has that big of a spare HD.
So I booted in Safe mode and ran the following fsck command from Terminal:
/sbin/fsck -f /dev/disk3s3
I received the following answer:
"BAD SUPER BLOCK: MAGIC NUMBER WRONG
LOOK FOR ALTERNATE SUPERBLOCKS? no"
My UNIX knowledge pretty much ended at this. I surmise from the answer that I won the UNIX "corrupted directory" jackpot. Does anyone know what commands I should enter to look for alternate superblocks or perform some other remedial action here? Thank you in advanceGeorge,
When you formatted the drive, did you re-partition it and format it with HFS+? It seems partitioned by another OS, which allows HFS+ volumes. Did you use a boot loader, so you could boot two OSs from the disk? I'll just offer some more things sighted, not insights.
This is looking like a common problem, though; so I could use some help with ownership & permissions from someone. It would seem that Tiger & Leopard both mount NTFS partitions read only, but NTFS-3g's permission system is similar enough to Unix's that it can be mounted read/write.
MacFUSE appears to do things with 'FUSE', a mystical object at first glance, one whose permissions can be converted to either HFS+, ext2, or usf. The ownership & permissions appear to change with where the external drive is mounted on the boot disk's file tree. I assume you know all about these things.
Is using them together a good idea? In any case, they both allow a file system to be mounted read/write, and modify the Mac OS itself. Here's an interesting remark from the MacFUSE FAQ:
+Q 3.2. After installing MacFUSE, I can't mount any disk images, optical discs, etc. What's going on?+
+A: It's likely that you installed a broken ntfs-3g package you found on the Internet. The package might be interfering with the disk image/disc mounting process. Try removing the /System/Library/Filesystems/ntfs-3g.fs/ directory.+
Also, Leopard's update 10.5.1 has the sentence:
+Addresses formatting issues with certain drives used with Time Machine (specifically, single-partition MBR drives greater than 512 GB in size as well as NTFS drives of any size and partition scheme).+
You can check the volume's ownereship & permissions with a Ctrl-click 'Info Menu' on the mounted volume's icon. Does all look OK?
Wish I knew more, but perhaps these observations will give you some ideas. Best of luck.
Bruce -
HFS drive bad/missing superblock magic number
Should an HFS drive have a superblock and magic number or is that strictly a UFS thing? I get this error but my drive is Mac formatted.
Hi,
You can run "fsck" command by giving the alternate superblock. The alternate superblock should have given during the filesystem creation in the disk using the "newfs" command. If there is nothing you need to run the "newfs" command for the filesystem creation where you will loose your entire data.
Regards,
Dharani
SlashSupport Indi Pvt Ltd.
Hi,
I've umounted a SunBlade 100 ide ATA II disk , and put
into
a linux box who can only read ufs.
Then when i mounted a hd again in a SunBlade 100 i've
found
that appears the message "corrupt label ..."
The hardisk it won't be able to boot. Then i've
mounted as
secondary of another SunBlade100 and i've tried to
access
to data, but when i've mounted i can't it.
And i did the next:
fsck -F ufs /dev/rdsk/c0t2d0s2 :
** /dev/dsk/c0t2d0s0
BAD SUPERBLOK : MAGIC NUMBER WRONG
use an alternate super-block to supply needed
information
I've tried to to the next :
fsck -F ufs -o b=32 /dev/rdsk/c0t2d0s0
But it was fail ....
Anybody can help me ?
Thanks -
How to come up with a magic number for any table that returns more than 32KB?
I am in a unique situation where in I am trying to retrieve values from multiple tables and publish them as XML output. The problem is based on the condition a few tables could retrieve data more than 32KB and a few less than 32KB. Less than 32KB is not an issue as XML generation is smooth. The minute it reaches greater than 32KB it generates a run time error. Just wondering if there is any way to ensure that the minute the query's results is greater than 32 kb, it should break say - if the results is 35KB, then I should break that result into 32 KB and 3kb; once done then pass this data to be published as an XML output. This is again not just for one table, but all the tables that are called in the function.
Is there any way?? I am unable to get any ideas nor have I done anything so complex from production support stand point. Would appreciate if someone can guide me on this.
The way it is, is as follows:
I have a table called ctn_pub_cntl
CREATE TABLE CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id NUMBER(18)
,table_name VARCHAR2(50)
,last_pub_tms DATE
,queue_name VARCHAR2(50)
,dest_system VARCHAR2(50)
,frequency NUMBER(6)
,status VARCHAR2(8)
,record_create_tms DATE
,create_user_id VARCHAR2(8)
,record_update_tms DATE
,update_user_id VARCHAR2(8)
,CONSTRAINT ctn_pub_cntl_id_pk PRIMARY KEY(ctn_pub_cntl_id)
Data for this is:
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_SBDVSN'
,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.TSZ601.UNP'
,'SAP'
,15
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_TRACK_SGMNT_DN'
,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,30
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FXPLA_TRACK_LCTN_DN'
,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.YRDPLN.INPUT'
,'SAP'
,30
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FXPLA_TRACK_LCTN2_DN'
,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.TSZ601.UNP'
,'SAP'
,120
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FXPLA_TRACK_LCTN2_DN'
,TO_DATE('04/23/2015 11:50:00PM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.YRDPLN.INPUT'
,'SAP'
,10
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FIXED_PLANT_ASSET'
,TO_DATE('04/23/2015 11:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,10
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_OPRLMT'
,TO_DATE('03/26/2015 7:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,30
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_OPRLMT_SGMNT_DN'
,TO_DATE('03/28/2015 12:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,30
COMMIT;
Once the above data is inserted and committed, then I created a function in a package:
CREATE OR REPLACE PACKAGE CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH
IS
TYPE tNameTyp IS TABLE OF ctn_pub_cntl.table_name%TYPE INDEX BY BINARY_INTEGER;
g_tName tNameTyp;
TYPE tClobTyp IS TABLE OF CLOB INDEX BY BINARY_INTEGER;
g_tClob tClobTyp;
FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_count OUT NUMBER ) RETURN tClobTyp;
END CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH;
--Package body
CREATE OR REPLACE PACKAGE BODY CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH
IS
doc xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
child_node xmldom.DOMNode;
child_elmt xmldom.DOMElement;
leaf_node xmldom.DOMNode;
elmt_value xmldom.DOMText;
tbl_node xmldom.DOMNode;
table_data XMLDOM.DOMDOCUMENTFRAGMENT;
l_ctx DBMS_XMLGEN.CTXHANDLE;
vStrSqlQuery VARCHAR2(32767);
l_clob tClobTyp;
l_xmltype XMLTYPE;
--Local Procedure to build XML header
PROCEDURE BuildCPRHeader IS
BEGIN
child_elmt := xmldom.createElement(doc, 'PUBLISH_HEADER');
child_node := xmldom.appendChild (root_node, xmldom.makeNode (child_elmt));
child_elmt := xmldom.createElement (doc, 'SOURCE_APLCTN_ID');
elmt_value := xmldom.createTextNode (doc, 'CTN');
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
child_elmt := xmldom.createElement (doc, 'SOURCE_PRGRM_ID');
elmt_value := xmldom.createTextNode (doc, 'VALUE');
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
child_elmt := xmldom.createElement (doc, 'SOURCE_CMPNT_ID');
elmt_value := xmldom.createTextNode (doc, 'VALUE');
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
child_elmt := xmldom.createElement (doc, 'PUBLISH_TMS');
elmt_value := xmldom.createTextNode (doc, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS'));
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
END BuildCPRHeader;
--Get table data based on table name
FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_Count OUT NUMBER) RETURN tClobTyp IS
vTblName ctn_pub_cntl.table_name%TYPE;
vLastPubTms ctn_pub_cntl.last_pub_tms%TYPE;
BEGIN
g_vProcedureName:='GetCtnData';
g_vTableName:='CTN_PUB_CNTL';
SELECT table_name,last_pub_tms
INTO vTblName, vLastPubTms
FROM CTN_PUB_CNTL
WHERE ctn_pub_cntl_id=p_nInCtnPubCntlID;
-- Start the XML Message generation
doc := xmldom.newDOMDocument;
main_node := xmldom.makeNode(doc);
root_elmt := xmldom.createElement(doc, 'PUBLISH');
root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
--Append Table Data as Publish Header
BuildCPRHeader;
--Append Table Data as Publish Body
child_elmt := xmldom.createElement(doc, 'PUBLISH_BODY');
leaf_node := xmldom.appendChild (root_node, xmldom.makeNode(child_elmt));
DBMS_SESSION.SET_NLS('NLS_DATE_FORMAT','''YYYY:MM:DD HH24:MI:SS''');
vStrSqlQuery := 'SELECT * FROM ' || vTblName
|| ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
-- || ' AND rownum < 16'
DBMS_OUTPUT.PUT_LINE(vStrSqlQuery);
l_ctx := DBMS_XMLGEN.NEWCONTEXT(vStrSqlQuery);
DBMS_XMLGEN.SETNULLHANDLING(l_ctx, 0);
DBMS_XMLGEN.SETROWSETTAG(l_ctx, vTblName);
-- Append Table Data as XML Fragment
l_clob(1):=DBMS_XMLGEN.GETXML(l_ctx);
elmt_value := xmldom.createTextNode (doc, l_clob(1));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
xmldom.writeToBuffer (doc, l_clob(1));
l_clob(1):=REPLACE(l_clob(1),'<?xml version="1.0"?>', NULL);
l_clob(1):=REPLACE(l_clob(1),'<', '<');
l_clob(1):=REPLACE(l_clob(1),'>', '>');
RETURN l_clob;
DBMS_OUTPUT.put_line('Answer is' ||l_clob(1));
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.put_line('There is no data with' || SQLERRM);
g_vProcedureName:='GetCtnData';
g_vTableName:='CTN_PUB_CNTL';
g_vErrorMessage:=SQLERRM|| g_vErrorMessage;
g_nSqlCd:=SQLCODE;
ctn_log_error('ERROR',g_vErrorMessage,'SELECT',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName);
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR : ' || SQLERRM);
ctn_log_error('ERROR',g_vErrorMessage,'OTHERS',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName);
END GetCtnData;
PROCEDURE printClob (result IN OUT NOCOPY CLOB) IS
xmlstr VARCHAR2 (32767);
line VARCHAR2 (2000);
BEGIN
xmlstr := DBMS_LOB.SUBSTR (result, 32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR (xmlstr, 1, INSTR (xmlstr, CHR (10)) - 1);
DBMS_OUTPUT.put_line (line);
xmlstr := SUBSTR (xmlstr, INSTR (xmlstr, CHR (10)) + 1);
END LOOP;
END printClob;
END CTN_PUB_CNTL_EXTRACT_PUBLISH;
If you notice my query:
vStrSqlQuery := 'SELECT * FROM ' || vTblName
|| ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
|| ' AND rownum < 16'
The minute I comment
|| ' AND rownum < 16' ;
, it throws an error because this query returns around 600 rows and all of those rows need to be published as XML and the tragedy is that there is a C program in between as well i.e. C will call my packged functions and then will do all the processing. Once this is done will pass the results back to C program. So obviously C does not recognise CLOB and somewhere in the process I have to convert the CLOB to VARCHAR or instead of CLOB I have to use VARCHAR array as a return type. This is my challenge.
Anyone that can help me to find out the required magic number and also a brief know how, I would appreciate that. Many thanks in advance.Not sure I understand which part is failing.
Is it the C program calling your packaged function? Or does the error occur in the PL/SQL code, in which case you should be able to pinpoint where it's wrong?
A few comments :
1) Using DOM to build XML out of relational data? What for? Use SQL/XML functions.
2) Giving sample data is usually great, but it's not useful here since we can't run your code. We're missing the base tables.
3) This is wrong :
vStrSqlQuery := 'SELECT * FROM ' || vTblName || ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
A bind variable should be used here for the date.
4) This is wrong :
elmt_value := xmldom.createTextNode (doc, l_clob(1));
createTextNode does not support CLOB so it will fail as soon as the CLOB you're trying to pass exceeds 32k.
Maybe that's the problem you're referring to?
5) This is most wrong :
l_clob(1):=REPLACE(l_clob(1),'<?xml version="1.0"?>', NULL);
l_clob(1):=REPLACE(l_clob(1),'<', '<');
l_clob(1):=REPLACE(l_clob(1),'>', '>');
I understand what you're trying to do but it's not the correct way.
You're trying to convert a text() node representing XML in escaped form back to XML content.
The problem is that there are other things to take care of besides just '<' and '>'.
If you want to insert an XML node into an existing document, treat that as an XML node, not as a string.
Anyway,
Anyone that can help me to find out the required magic number
That would be a bad idea. Fix what needs to be fixed.
And please clearly state which part is failing : the C program or the PL/SQL code?
I'd vote for PL/SQL, as pointed out in [4]. -
Hello.
Do anybody know about what doing with this error:
mount /dev/sde /raid/4
mount.ocfs2: Bad magic number in inode while trying to determine heartbeat information
fsck.ocfs2 /dev/sde
fsck.ocfs2 1.6.4
fsck.ocfs2: Bad magic number in inode while initializing the DLM
sudo debugfs.ocfs2 /dev/sde
debugfs.ocfs2 1.6.4
debugfs: ls //
ls: Bad magic number in inode while checking directory at block 66
debugfs: stats
Revision: 0.90
Mount Count: 0 Max Mount Count: 20
State: 0 Errors: 0
Check Interval: 0 Last Check: Sat Oct 18 06:30:52 2014
Creator OS: 0
Feature Compat: 3 backup-super strict-journal-super
Feature Incompat: 592 sparse inline-data xattr
Tunefs Incomplete: 0
Feature RO compat: 1 unwritten
Root Blknum: 65 System Dir Blknum: 66
First Cluster Group Blknum: 32
Block Size Bits: 12 Cluster Size Bits: 17
Max Node Slots: 16
Extended Attributes Inline Size: 256
Label: mediadisk4
UUID: 1126B3D209AA4BE088260B2A590AB995
Hash: 2997730071 (0xb2adbb17)
DX Seed[0]: 0x00000000
DX Seed[1]: 0x00000000
DX Seed[2]: 0x00000000
Cluster stack: classic o2cb
Inode: 2 Mode: 00 Generation: 2716855348 (0xa1efec34)
FS Generation: 2716855348 (0xa1efec34)
CRC32: 00000000 ECC: 0000
Type: Unknown Attr: 0x0 Flags: Valid System Superblock
Dynamic Features: (0x0)
User: 0 (root) Group: 0 (root) Size: 0
Links: 0 Clusters: 213645733
ctime: 0x50bf9210 -- Wed Dec 5 22:27:28 2012
atime: 0x0 -- Thu Jan 1 03:00:00 1970
mtime: 0x50bf9210 -- Wed Dec 5 22:27:28 2012
dtime: 0x0 -- Thu Jan 1 03:00:00 1970
ctime_nsec: 0x00000000 -- 0
atime_nsec: 0x00000000 -- 0
mtime_nsec: 0x00000000 -- 0
Refcount Block: 0
Last Extblk: 0 Orphan Slot: 0
Sub Alloc Slot: Global Sub Alloc Bit: 65535
Thanks for any help.This looks to be filesystem corruption. The reason the fsck's don't find anything is they are really _not_ doing any checking. In the filesystem is an unmounted-cleanly flag. This flag is set when the umount(1) is done. If the system were to crash with the filesystem still mounted, this unmounted-cleanly flag would not be set, so the system would consider the filesystem to need checking: no unmounted-cleanly flag, fsck has work to do; unmounted-cleanly flag set means fsck does nothing.
Be sure the filesystem is unmounted all around the cluster before attempting to repair the filesystem.
So do this:
# fsck.ocfs2 -f /path/to/device/partition
The "-f" switch forces fsck.ocfs2 to ignore the state of the "unounted-cleanly" flag and actually perform its tests.
Does this repair the problem?
Maybe you are looking for
-
How to get the values and attributes of Longlived processes by using ProcessID.
Hi Experts, For every process we creates, LC ES2 creates processID. we know that if you creates a long lived process, all the values which are in proces will be stored some where in DB. Here my requirement is by using processID I need to get al
-
Z3 Compact not able to do things while on call
I've noticed with my Z3 Compact that it doesn't allow me to really do anything in a call. Like reply to a text, etc. Where as with other android devices, and apple products I have been able to do while doing same things. It allows you to get into mes
-
Which new Mac Mini to buy?
I'm looking to buy the new mac mini. Please help me decide which one that I should buy based on my uses. I will use this computer for app development, internet browsing, some photo editing, and maybe even for games. I know that I will at least need t
-
Hi, We are using SAP BI 7.0 The requirement is to count the "TOTAL number of EQUIPMENTS" in a plant with reference to "EQUIPMENT TYPE" to report the MTBF against each equipment type. I have created a CKF, created a formula variable and using the repl
-
Itunes freezes when adding media to Iphone
I have just updated to Itunes 10.2.2.14 on Windows XP, I also have never synced my Iphone 3g to itunes, but when attempting to add any media to the iphone, the progress bar stops halfway on the first song, the arrows remain spinning but nothing happe