System tablespace gets corrupted.

Hi,
My system tablespace gets corrupted. My Database is not running in archivelog mode and also i dont have any backup. Is there is any solution to recover corrupted blocks in system tablespace;

had the same few weeks ago at one of our customers
SYSTEM tablespace (SYSTEM01.DBF) got corrupted due to power outage/disk error
no archiving, no backup (database for testing purposes, which they update periodically with data from the production database)
tried recovery (as Rafi suggested above), but it didnt work, it said SYSTEM01.DBF needs further recovery, thus open resetlogs wont work
and it was right, resetlogs didnt work :)
so the options:
1. recovery/restore - not possible
2. Oracle has a private tool called Oracle Data Unloader that can get the data from the datafiles - just a test database, doesnt worth the work/time/money
3. open the database with the allowresetlogs_corruption=TRUE hidden parameter, and try a full export
database could be opened with resetlogs by using this parameter
the reward for this action: several ORA-600s per second, instance crashed in 30-60 seconds
at the end we dropped the database and duplicated the production one

Similar Messages

  • How to recover database SYSTEM datafile get corrupt ?

    Database is in ARCHIVELOG mode, and the datafile belonging to SYSTEM tablespace gets corrupted. Up to what point can I recover the database ?
    A. Until last commit.
    B. Until the time you perform recovery.
    C. Until the time the datafile got corrupted.
    D. You cannot recover the SYSTEM tablespace and you must be re-create the database.
    and 1 more doubt :
    If redologfiles are not multiplexed and redolog blocks get corrupt in group 2, and archiving stops. All redolog files are filled and database activity is halted.
    DBWR has written everything to disk. What command can be used to proceed further ?
    A. recover logfile block group 2;
    B. alter database drop logfile group 2;
    C. alter database clear logfile group 2;
    D. alter database recover logfile group 2;
    E. alter database clear unarchived lofile group 2;
    Edited by: user642367 on Sep 18, 2008 8:45 PM

    1. A. Since the DB is in archivelog mode, so you can always restore and recover the whole DB including system tablespace datafile till last SCN generated provided the redo record is available in archive/online logfiles.
    2. E. Since only redolog is corrupted so archiver won't proceed and hence a db hang is obvious, So, in order to proceed further you need to clear online (un archived log file) and then db will work as usual. Care should be taken that you must take a full backkup of DB(cold backup wherever feasible) as soon as possible after issuing this command. As now you don't have redo info in archivelog files to recover the db in case of a crash.
    Please go through Oracle 10g DB Administrators guide (available on OTN) for more details.
    Thanks

  • RMAN restore when system datafile get corrupt

    Hi,
    I am new to Backup and recovery, Can anybody suggest.
    If my system datafile gets corrupt, do I need to restore and recover complete database or just datafile restore will be suffice.
    In case the database is running on archive log mode.
    Waiting for reply.
    Thanks & Regards,
    Deepak

    Deepak Pushkarna wrote:
    Hi,
    I am new to Backup and recovery, Can anybody suggest.
    If my system datafile gets corrupt, do I need to restore and recover complete database or just datafile restore will be suffice.
    In case the database is running on archive log mode.
    Waiting for reply.
    Thanks & Regards,
    DeepakMount you database
    restore tablespace system
    recover tablespace system

  • Oracle 9i System file get corrupted. How to remove the corruption.

    Hello,
    I am facing problem during backup of oracle database (Oracle 9i, 32 bit windows). Pls see the following error messages.
    Sep 16 10:48:41 mnmccbr.mci.sc: * mnmcfs.mci.sc:E:\SC\SC12.1\Databases\Oracleconfig\oraBackupNM45 ORA-19566:
    exceeded limit of 0 corrupt blocks for file E:\SC\SC12.1\DATABASES\ORACLECONFIG\SYS1NM45.ORA
    Output of dbverify.
    DBVERIFY: Release 9.2.0.6.0 - Production on Sat Oct 11 09:40:42 2008
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    DBVERIFY - Verification starting : FILE = E:\SC\SC12.1\DATABASES\ORACLECONFIG\SYS1NM45.ORA
    Page 28093 is marked corrupt ***
    Corrupt block relative dba: 0x00406dbd (file 1, block 28093)
    Bad check value found during dbv:
    Data in bad block -
    type: 6 format: 2 rdba: 0x00406dbd
    last change scn: 0x0000.09abd22e seq: 0x2 flg: 0x06
    consistency value in tail: 0xd22e0602
    check value in block header: 0x8b91, computed block checksum: 0x800
    spare1: 0x0, spare2: 0x0, spare3: 0x0
    DBVERIFY - Verification complete
    Total Pages Examined : 31616
    Total Pages Processed (Data) : 21138
    Total Pages Failing (Data) : 0
    Total Pages Processed (Index): 7246
    Total Pages Failing (Index): 0
    Total Pages Processed (Other): 1451
    Total Pages Processed (Seg) : 0
    Total Pages Failing (Seg) : 0
    Total Pages Empty : 1780
    Total Pages Marked Corrupt : 1
    Total Pages Influx : 0
    Highest block SCN : 224578617 (0.224578617)
    The Backup is enabled in our machine but we are not able to take backup since we we get the error (6 Sept). I am not sure whether archive log are available since 6th Sept. Even oracle is working fine but backup is not possible.
    Pls note that this is customer testbed. Any idea to remove the corruption from the system file.
    Thanks
    With Regards
    Hemant Joshi

    Hello All,
    I tried the resize procedure but the corruption doesn't cleared.
    SQL> ALTER DATABASE DATAFILE 'E:\SC\SC12.1\DATABASES\ORACLECONFIG\SYS1NM45.ORA' RESIZE 246 M;
    Database altered.
    SQL> ALTER DATABASE DATAFILE 'E:\SC\SC12.1\DATABASES\ORACLECONFIG\SYS1NM45.ORA' RESIZE 245 M;
    Database altered.
    SQL> ALTER DATABASE DATAFILE 'E:\SC\SC12.1\DATABASES\ORACLECONFIG\SYS1NM45.ORA' RESIZE 244 M;
    ALTER DATABASE DATAFILE 'E:\SC\SC12.1\DATABASES\ORACLECONFIG\SYS1NM45.ORA' RESIZE 244 M
    ERROR at line 1: ORA-03297: file contains used data beyond requested RESIZE value
    SQL> ALTER DATABASE DATAFILE 'E:\SC\SC12.1\DATABAES\ORACLECONFIG\SYS1NM45.ORA' RESIZE 400 M;
    Database altered.
    Can you please let me know how to recover corrupted Block or how to recover the corrupted file only.
    Thanks
    With Regards
    Hemant Joshi.

  • System Tablespace getting very big!

    Hi All,
    I am working on a 10g RAC database on RHEL5. The tablespace System has grown very big. It is due to
    C_OBJ#_INTCOL# and
    I_H_OBJ#_COL#.
    The database has 4 tables which are quite big and have lots of partitions. It is the object stats and histogram stats on the partitions which are collected by the auto stats gather job. I have disabled that for the time being. Is there any way that i can modify that job in such a way that AUTO stats gather job runs but does not collect the histograms stats?

    Can i enable the AUTO_STATS_GATHER job after applying the bug patch 6390838?

  • Block Corruption in SYSTEM Tablespace

    Hi,
    well it´s just a test database without a backup, but i would like to repair it anyway :-)
    Here are the facts:
    Errors in file c:\oracle\admin\o10g\bdump\o10g_smon_1404.trc:
    ORA-01578: ORACLE data block corrupted (file # 1, block # 50187)
    ORA-01110: data file 1: 'C:\ORACLE\ORADATA\O10G\SYSTEM01.DBF'
    1. I found the object: It´s a Cluster named SYS.C_TOID_VERSION#
    containing a lot of table stuff (type$,parameter$, ...)
    i tried to repair it with dbms_repair:
    BEGIN SYS.DBMS_REPAIR.SKIP_CORRUPT_BLOCKS (
    SCHEMA_NAME => 'SYS',
    OBJECT_NAME => 'C_TOID_VERSION#',
    OBJECT_TYPE => dbms_repair.cluster_object,
    FLAGS => dbms_repair.skip_flag);
    END;
    No error, but the same block corruption message in the alert.log 1 minute later.
    i can select the tables in the cluster.
    Has anyboby another trick to repair a cluster?
    Thanks
    Marco

    Hi,
    if you have rman backup then this problem become resolved by only one command.
    BLOCKRECOVER DATAFILE 1 BLOCK 3 DATAFILE 50187;
    otherwise restore system tablespace from backup and recover it.
    and one more thing
    **Don't fix the block in system tablespace it may create problem if that block contain some useful information of oracle(internal information).
    Thanks
    Kuljeet Pal Singh

  • Alter index ... rebuild was failing - getting corrupt blocks

    Database: 9.2.0.5
    OS: HPUX-ia64
    Hello,
    i rebuilded a index, announced from UpdatStats in DB13, and get a ORA-01114: IO error writing block to file 2045 (block # 319154) and
    ORA-27072: skgfdisp: I/O error in my sqlplus session.
    -> i do a alter index SAPR3."xxx~0" rebuild online parallel 4 nologging;
    -> System was up and running
    After that, the DBVerify marked some blocks corrupt, here one example:
    BR0398E DBVERIFY detected corrupted blocks in /oracle/XXX/sapdata22/btabi_95/btabi.data95
    We checked all corrupted blocks - all in free space.
    So we fixed that with creating a table with next extend size from the corrupted blocksize.
    I think we had not enough space in the tablespace where the index is, okay ... and what we also found, the PSAPTEMP datafiles was created as SPARSE files ...!!
    -> PSAPTEMP-Datafile: 10GB in the System - 2,5GB maximum on OS-Level, no more space.
    But my question is why i am getting corrupt blocks when a "alter index ... rebuild ..." is failing ?!?!
    Thank you for your support.
    Regards,
    Markus
    Edited by: Markus Dinkel on Oct 9, 2008 12:56 PM
    Edited by: Markus Dinkel on Oct 9, 2008 12:56 PM
    Edited by: Markus Dinkel on Oct 9, 2008 12:59 PM

    Thany you for the answer.
    I cant find any "cor" entries in the last DBVeriy log.
    I think (hope) we dont' have anymore corrupted blocks in the system.
    We get a response from SAP to update to 9.2.0.8.
    My customer wanna do a update to oracle 10 in march/april 2009, so he send me the question if we need a update to 9.2.0.8 ASAP or can we wait for the update to oralce10.
    But the important question from my customer and me is, why we get corrupt blocks after failing the alter index rebuild?
    Regards,
    Markus

  • System tablespace space not regained when objects are dropped

    Mine is a Oracle 10g 10.2 on windows.
    I am importing a export file into a user ,It takes some amount of space in SYSTEM and another tablespace .When I drop the user space in system tablespace is not coming back. ANY IDEA WHY
    BEFORE IMPORT
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYSTEM';
    SUM(BYTES)/1024/1024
    22.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYS';
    SUM(BYTES)/1024/1024
    544.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where segment_name='SOURCE$';
    SUM(BYTES)/1024/1024
    41
    I use the following commands to import
    SQL>create user <username> identified by <password> default tablespace <tsname> quota unlimited on <tsname>;
    SQL>grant create session,imp_full_database to <username>;
    imp system file=filename.dmp log=logname.log fromuser=<username> touser=<username> statistics=none
    AFTER IMPORT
    SQL> select sum(bytes)/1024/1024 from dba_segments where segment_name='SOURCE$';
    SUM(BYTES)/1024/1024
    53
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYSTEM';
    SUM(BYTES)/1024/1024
    22.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYS';
    SUM(BYTES)/1024/1024
    728.375
    AFTER DROPPING THE USER/SCHEMA
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYS';
    SUM(BYTES)/1024/1024
    728.375
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYSTEM';
    SUM(BYTES)/1024/1024
    22.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where segment_name='SOURCE$';
    SUM(BYTES)/1024/1024
    53
    I even tried deleting the objects first and then dropping the user
    SQL> delete from source$ where obj# in(select object_id from dba_objects where owner='USERNAME');
    211252 rows deleted.
    SQL> commit;
    Commit complete.
    SQL> drop user USERNAME cascade;
    User dropped.
    The space used by the schema on system tablespace is not coming back.

    Hi user509593!
    Adding objects to a tablespace requires space in that tablespace. This space is managed in segments and extents. If an extent is fully used (that means 100 % usage) a new extent will be added to a segment. Oracle uses a mechanism called "High Water Mark" to mark the last used extent.
    Your problem is that oracle don't set this High Water Mark back if you are dropping objects from a tablespace. Once an extent is marked as it it retains marked as used.
    Before Adding Objects:
    u = used Extent
    x = free Extent
    | = High Water Mark
    uuuuuuxxxxx
    ...........|
    After Adding Objects:
    uuuuuuuxxxx
    ............|
    After dropping objects:
    uuuuuuuxxxx
    ............|
    The only chance to get your "unused" space back is to reorganized your tablespace. But before you reorganize something please read the documentation to know all about the costs and traps that comes with reorganization.
    Hope this help!
    null

  • TEMP tablespace getting full while inserting a CLOB in Trigger

    We have a Oracle 10g (10.2.0.4.0) DB on a Solaris 9 box which also runs our J2EE web-service application on Weblogic 8sp6 server.
    We get around 220K web-service requests from upstream callers daily to insert data in the main table, say TABLE1, which has daily partitions on a date column. This table has around 21 columns out of which 1 is a CLOB column.
    Now this table has an AFTER INSERT trigger which calls a package procedure to insert the same record into another table, say TABLE2.
    From Java application insert statement in executed in below format using a weblogic jdbc connection pool :
    INSERT INTO TABLE1(COLUMN1, COLUMN2, ........., CLOB_COLUMN,........, COLUMN21) VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20);
    Clob object is prepared in application using ojdbc14.jar.
    We are observing a strange issue here. The TEMP tablespace utilization keeps on growing as more and more inserts are executed by application and after ~125K inserts the TEMP tablespace gets full and we start getting ORA-01652 error.
    On further analysis we could see that there are only 7-10 session being maintained but as more and more inserts happen TEMP tablespace utilization goes on increasing for each of these sessions.
    When we tried with inserting just few records and then watching the session details in v$session_wait then we could see that it is in INACTIVE state and waiting for the event ‘SQL*Net message from client’. This does not seem correct as the session has successfully inserted the data and committed the transaction and we can see the data in the tables as well.
    The confusing thing here is when we modify the trigger to pass blank string('' ) instead of the CLOB column to TABLE2 then this issue does not occur. All 200K records are inserted properly and TEMP tablespace utilization also keep always below 1%.
    Can you please help us in solving this issue. Is this related to any oracle issue?
    Inside the package we have tried using DBMS_COPY statement to copy the CLOB column after insert but still same result.
    Code for reference:
    Trigger:
    =====================================
    CREATE OR REPLACE TRIGGER trg
    AFTER INSERT OR UPDATE
    ON TABLE1
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    IF (:NEW.date_col > SYSDATE - 2)
    THEN
    IF (:NEW.cat IN (1001, 1002))
    THEN
    pkg.process_change
         (:NEW.COLUMN1,
              :NEW.COLUMN2,
              :NEW.CLOB_COLUMN,
    FLAG
    END IF;
    END IF;
    END;
    =====================================
    Package:
    =====================================
    procedure PKG.Process_change(
    p_COLUMN1 number,
    p_COLUMN2 varchar2,
    p_CLOB_COLUMN clob,
    flag boolean
    ) is
    v_watermark pls_integer;
    v_type varchar2(1);
    begin
    if (flag) then
    v_type := 'U';
    else
    v_type := 'I';
    end if;
    select t_seq.nextval into v_watermark from dual;
    insert into TABLE2(
    COLUMN1 number,
    COLUMN2 varchar2,
    CLOB_COLUMN clob,
    watermark,
    dml_type
    )values (
    p_COLUMN1 number,
    p_COLUMN2 varchar2,
    p_CLOB_COLUMN clob,
    v_watermark,
    v_dml_type
    end;
    =====================================

    My first thought on reading your post is that not only are you using a database version that is now so old it is in extended support and even then not even the most recent patchset for it.
    The first thing I would do is move to 11gR2 and if you can't do that at least get to 10.2.0.5 and apply CLOB relevant patches as well.
    Same goes for your operating system. Solaris 9 is ancient: So move to 10 which has vastly improved memory management.
    To help you further it would be really valuable to know the table layout. For example is this a heap table or an IOT? Is it partitioned? Is this RAC? What size are the CLOBs? Are they stored in-line? Chunk size? etc.
    This page should start you down the right road:
    http://docs.oracle.com/cd/B19306_01/appdev.102/b14249/adlob_tables.htm#sthref204
    But I am also wondering why you would use a trigger to, as you say, "insert the same record into another table." This description is a poster child for "bad design."

  • RMAN duplicate target database for standby from active fails to create newname for system tablespace/datafile

    When executing 'duplicate target database for standby from active'  the system tablespace/datafile (datafile 1)  is not cloned.  All other datafiles clone successfully.  The RMAN process aborts with the following errors while attempting to clone the system tablespace/datafile.
    ORA-19558: error de-allocating device
    ORA-19557: device error, device type: DISK, device name:
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-17627: ORA-01041: internal error. hostdef extension doesn't exist
    ORA-03135: connection lost contact
    Here are the details:
    Primary is 11.2.0.2 RAC database  on an Exadata platform
    Standby is 11.2.0.2 Single Instance database (same patch level as primary) on a Red Hat Linux box
    This is an ASM to ASM duplication.
    This is not unique to this database.  We tried another database and go the same behavior - all datafiles clone successfully with the exception of the system tablespace/datafile.
    We have traced the RMAN execution and it seems to fail when it is trying to assign a NEWNAME to the system tablespace/datafile.
    We even issued an explicit SET NEWNAME command but RMAN ignored it.
    We also shutdown the primary and started is up in mount mode thinking that something had ahold of the System Tablespace/datafile.
    We also opened up the network firewall to allow permit any,any traffic.
    We increased the max_server_processes
    and added TCP.NODELAY=yes to the sqlnet.ora file.
    There seems to be some artifact present in our Primary System tablespace/data file that is preventing it form being cloned.
    checked all alert files grid, asm,  and dbhome - no abnormal messages.
    We are in the process of restoring the database from a backup but we would prefer to get this working using the 'Active Database' methodology

    I successfully created the standby database using RMAN backup and recovery.
    I started the managed recovery.  Archive logs are being sent from the primary to the standby ( I can see them in ASM), but the standby is not applying them.
    I get the following messages in the standby alert log...
    Fetching gap sequence in thread 2, gap sequence 154158-154257
    Tue Nov 26 16:19:58 2013
    Using STANDBY_ARCHIVE_DEST parameter default value as USE_DB_RECOVERY_FILE_DEST
    Using STANDBY_ARCHIVE_DEST parameter default value as USE_DB_RECOVERY_FILE_DEST
    Tue Nov 26 16:20:01 2013
    Fetching gap sequence in thread 2, gap sequence 154158-154257
    Tue Nov 26 16:20:11 2013
    Fetching gap sequence in thread 2, gap sequence 154158-154257
    Tue Nov 26 16:20:22 2013
    Fetching gap sequence in thread 2, gap sequence 154158-154257
    Tue Nov 26 16:20:32 2013
    Fetching gap sequence in thread 2, gap sequence 154158-154257
    I don't see any MRP processes:
    select process,
    status,
        thread#,
        sequence#,
       block#,
      blocks
      7     from v$managed_standby;
    PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS
    ARCH      CLOSING               2     154363          1        132
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0
    RFS       IDLE                  0          0          0          0
    RFS       IDLE                  1     145418        121          1
    RFS       IDLE                  0          0          0          0
    PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS
    RFS       IDLE                  0          0          0          0
    12 rows selected.
    SQL>  SELECT THREAD#, SEQUENCE#, APPLIED FROM V$ARCHIVED_LOG;
       THREAD#  SEQUENCE# APPLIED
             2     154356 NO
             2     154357 NO
             1     145411 NO
             2     154358 NO
             2     154360 NO
             2     154361 NO
             1     145414 NO
             1     145415 NO
             2     154362 NO
             2     154363 NO
             1     145416 NO
    11 rows selected.
    I do have the archive logs that cover sequences 154158-154257
    Crosschecked 38 objects
    Crosschecked 62 objects
    Finished implicit crosscheck backup at 26-NOV-13
    Starting implicit crosscheck copy at 26-NOV-13
    using channel ORA_DISK_1
    using channel ORA_DISK_2
    Crosschecked 2 objects
    archived log file name=+RECO_XORA/nmuasb00/archivelog/2013_11_26/thread_2_seq_154377.344.832521989 RECID=29 STAMP=832521990
    validation succeeded for archived log
    archived log file name=+RECO_XORA/nmuasb00/archivelog/2013_11_26/thread_2_seq_154378.346.832521991 RECID=31 STAMP=832521993
    Crosschecked 31 objects

  • System datafile block corruption - no backups and database in NOARCHIVELOG mode

    Dear All,
    Database version - oracle 11.1 Enterprise
    OS - RHELinux 5.8
    What are the options of recovering from physical block corruption when there are no backup available to perform block media recovery?
    V$DATABASE_BLOCK_CORRUPTION reports two segments corrupted (please see attached image for details).
    1 table in system datafile - sys_fba_barrierscn
    1 index - (applicaiton index)
    What are my options?
    I know there is a possibility that the database will not restart after a shutdown due to corruption in system tablespace.
    Database is in noarchivelog mode. So online backups are not possible and there aren't any full backups either.
    I am thinking of below,
    1. Run dbms_repair with fix_block_corruption. - Still database startup might fail?
    2. Shutdown the database and take offline full backup with RMAN MAXCorrupt option.
    Appreciate your suggestions and advises.
    Thanks
    Stefan

    Thanks Sybrand,
    Agree with your first two suggestions .
    Also scheduled a expdp job tonight. (Only backup like thing they had was a expdp cron, but until today all the large tables were failing due to small undo_retention).
    Yes. Flashback is not used. So hopefully it will not affect the a database restart i guess?
    Related to dbms_repair, I was referring to - http://askdba.org/weblog/2010/08/physical-corruption-ora-1578-part-3/.
    Where DBMS_REPAIR.FIX_CORRUPT_BLOCKS and DBMS_REPAIR.SKIP_CORRUPT_BLOCKS used.
    Which i think will not use any redo.
    Thanks
    Stefan

  • Just installed itunes on new windows 7 system  Cant get it to import cd's when it is open.  I have to close it first and then insert cd to import

    just installed itunes on new windows 7 system  Cant get it to import cd's when it is open.  I have to close it first and then insert cd to import. any one know how to fix this?

    If your library was working on your computer and then popped up empty all of a sudden then this might be what you need...
    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    tt2

  • PDF file gets corrupted when generated from BSP

    Hi,
         I am generating a PDF file from a BSP page ( see the code below). The problem is that PDF file gets corrupted and  I am unable to open it. I also tried to use other functions like GUI_Download and DOwnload as suggested by many and they also do not work either. Has any one generated a PDF from BSP and can some one help?
    Data: GG type String.
    event handler for data retrieval
    data : event type ref to cl_htmlb_event.
    class cl_htmlb_manager definition load.
    class CL_HTTP_RESPONSE DEFINITION LOAD.
    DATA : PARAMS TYPE PRI_PARAMS,
             VALID  TYPE C,
    GV_SUCCESS_SPOOL_NO LIKE SY-SPONO.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING DESTINATION           = 'LOCL'
               COPIES                = COUNT
               LIST_NAME             = 'TEST'
               LIST_TEXT             = 'Test NEW-PAGE PRINT ON'
                  IMMEDIATELY           = ''
                  RELEASE               = 'X'
                  NEW_LIST_ID           = 'X'
               EXPIRATION            = DAYS
                  LINE_SIZE             = 140
               LINE_COUNT            = 23
               LAYOUT                = 'X_PAPER'
               SAP_COVER_PAGE        = 'X'
               RECEIVER              = 'SAP*'
               DEPARTMENT            = 'System'
                  NO_DIALOG             = 'X'
        IMPORTING OUT_PARAMETERS        = PARAMS
                  VALID                 = VALID.
      IF VALID <> SPACE.
        NEW-PAGE PRINT ON  PARAMETERS PARAMS NO DIALOG.
    write :/ 'Hello Message1'.
    write :/ 'Hello Message2 '.
    NEW-PAGE PRINT OFF .
      ENDIF.
    data :        spool_no TYPE TSP01-RQIDENT .
    spool_no = sy-spono.
    DATA: itab TYPE TLINE,
            witab TYPE TABLE OF TLINE,
            output TYPE STRING,
            outputx TYPE XSTRING.
    data : l_pdf_len type i.
    data: mi_bytecount type i.
    DATA : APP_TYPE TYPE STRING VALUE  'APPLICATION/PDF' .
    DATA:    cached_response TYPE ref to if_HTTP_RESPONSE.
    data : l_display_url type string .
    data : guid type GUID_32 .
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID              = spool_no
          NO_DIALOG                = 'X'
       IMPORTING
          PDF_BYTECOUNT            =  mi_bytecount
        TABLES
          PDF                      = witab
        EXCEPTIONS
          ERR_NO_ABAP_SPOOLJOB     = 1
          ERR_NO_SPOOLJOB          = 2
          ERR_NO_PERMISSION        = 3
          ERR_CONV_NOT_POSSIBLE    = 4
          ERR_BAD_DESTDEVICE       = 5
          USER_CANCELLED           = 6
          ERR_SPOOLERROR           = 7
          ERR_TEMSEERROR           = 8
          ERR_BTCJOB_OPEN_FAILED   = 8
          ERR_BTCJOB_SUBMIT_FAILED = 9
          ERR_BTCJOB_CLOSE_FAILED  = 10
          others                   = 11.
      if sy-subrc EQ 0.
        LOOP AT witab INTO itab.
          CONCATENATE
            output
            itab-tdline
          INTO output in character mode.
        ENDLOOP.
    endif.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
            EXPORTING
                text   = output
                mimetype =   'APPLICATION/PDF'
            IMPORTING
                buffer = outputx.
    concatenate cl_abap_char_utilities=>byte_order_mark_little
    outputx
    into outputx in byte mode.
      response->set_header_field( name = 'content-type' value =
    'APPLICATION/PDF; charset=utf-16le'  ).
      response->delete_header_field( name =
    if_http_header_fields=>cache_control ).
      response->delete_header_field( name = if_http_header_fields=>expires
      response->delete_header_field( name = if_http_header_fields=>pragma )
      response->set_header_field( name = 'content-disposition'
                                  value = 'attachment; filename = TEST.PDF'
      l_PDF_len = xstrlen( OUTPUTX ).
      response->set_data( data = OUTPUTx
                          length = l_PDF_len ).
    navigation->response_complete( ).
    Regards
    Amit Agrawal

    HI Craig Cmehil,
                   I have tried this code as well as given in the URL specified by you. But using this also browser shows the following  content. It seems that PDF content is corrupted.
    My Output as shown on Browser Starts below this line----
    DF-1.3
    %âãÏÓ
    2 0 obj
    /WinAnsiEncoding
    endobj
    3 0 obj
    <<
    /Type /Font
    /Subtype /Type1
    /BaseFont /Courier
    /Name /F001
    /Encodg 2 0 R
    >>
    endobj
    4 0 obj
    <<
    /Length 5 0 R
    >>
    stream
    /F001 7.30 Tf 0 0 0.753 rg BT 18.00 570.65 Td 0 Tw <33302E30362E3230302020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020>Tj ET 0 0 0.753 rg BT 2950 570.65 Td 0 Tw
    <20204854545020436F6E74726F6C202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020>Tj ET 0 0 0.753 rg BT 572.40 570.65 Td 0 Tw <2020202020202020202020202031>Tj ET q 0 0 0 RG 0.55 w 18.00 562.90 m
    634. 562.90 l S Q 0 0 0.753 rg BT 18.00 551.45 Td 0 Tw <48656C6C6F20416D6974>Tj ET 0 0 0.753 rg BT 18.00 541.85 Td 0 Tw <48656C6C6F204765726176>Tj ET
    endstream
    endobj
    5 0 obj
    624
    endobj
    6 0 obj
    <<
    /Type /Page
    /MediaBox
    /Parent 1 0 R
    /Resource
    <<
    /ProcSet
    /PDF /Text
    /Font
    <<
    /F001 3 0 R
    >>
    /XObject
    <<
    >>
    >>
    /Contents 4 0 R
    >>
    endobj
    7 0 obj
    <<
    /Author (AMG )
    /CreationDate (20050630 181301)
    /Creator (Form X_58_170 EN)
    /Producer (SAP R/3 Release 620 )
    %SAPinfoStart TOA_DARA
    %FUNCTI=(    )
    %MANDANT=(   )
    %DEL_DATE=(00000000)
    %SAP_OBJECT=(          )
    %AR_OBJECT=(          )
    %OBJECT_ID=(                          )
    %FORM_ID=(                                        )
    %FORMARCHIV=(  )
    %RESERVE=(   )
    %NOTIZ=(                                                                )
    %SAPinfoEnd TOA_DARA
    >>
    endobj
    1 0 obj
    <<
    /Type /Pages
    /Kids
    [ 6 0 R
    /Count 1
    >>
    endobj
    8 0 obj<<
    /Type /Catalog
    /Pages 1 0 R
    /PageMode /UseNone
    >>
    endobj
    xref
    0 9
    0000000000 65535 f
    0000001801 00000 n
    0000000017 0000n
    0000000052 00000 n
    0000000157 00000 n
    0000000840 00000 n
    0000000862 00000 n
    0000001048 00000 n
    0000001869 00000 n
    trailer
    /Size 9
    /Root 8 0 R
    /Info 7 0 R
    >>
    startxref
    1944
    %%EOF
    Browser Displey Content Ends----
    My Coding Starts----
    Data: GG type String.
    event handler for data retrieval
    data : event type ref to cl_htmlb_event.
    class cl_htmlb_manager definition load.
    class CL_HTTP_RESPONSE DEFINITION LOAD.
    DATA : PARAMS TYPE PRI_PARAMS,
             VALID  TYPE C,
    GV_SUCCESS_SPOOL_NO LIKE SY-SPONO.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING DESTINATION           = 'LOCL'
               COPIES                = COUNT
               LIST_NAME             = 'TEST'
               LIST_TEXT             = 'Test NEW-PAGE PRINT ON'
                  IMMEDIATELY           = ''
                  RELEASE               = 'X'
                  NEW_LIST_ID           = 'X'
               EXPIRATION            = DAYS
                  LINE_SIZE             = 140
               LINE_COUNT            = 23
               LAYOUT                = 'X_PAPER'
               SAP_COVER_PAGE        = 'X'
               RECEIVER              = 'SAP*'
               DEPARTMENT            = 'System'
                  NO_DIALOG             = 'X'
        IMPORTING OUT_PARAMETERS        = PARAMS
                  VALID                 = VALID.
      IF VALID <> SPACE.
        NEW-PAGE PRINT ON  PARAMETERS PARAMS NO DIALOG.
    write :/ 'Hello Amit'.
    write :/ 'Hello Gaurav '.
    NEW-PAGE PRINT OFF .
      ENDIF.
    GV_SUCCESS_SPOOL_NO = sy-spono.
    data :        spool_no TYPE TSP01-RQIDENT .
    spool_no = sy-spono.
    write: GV_SUCCESS_SPOOL_NO.
    *write: spool_no.
    IF display_type = 'convertspool'.
      DATA: itab TYPE TLINE,
            witab TYPE TABLE OF TLINE,
            output TYPE STRING,
            outputx TYPE XSTRING.
    data : l_pdf_len type i.
    data: mi_bytecount type i.
    DATA : APP_TYPE TYPE STRING VALUE  'APPLICATION/PDF' .
    DATA:    cached_response TYPE ref to if_HTTP_RESPONSE.
    data : l_display_url type string .
    data : guid type GUID_32 .
           spool_no like TSP01-RQIDENT .
    *spool_no = GV_SUCCESS_SPOOL_NO .
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID              = spool_no
          NO_DIALOG                = 'X'
       IMPORTING
          PDF_BYTECOUNT            =  mi_bytecount
        TABLES
          PDF                      = witab
        EXCEPTIONS
          ERR_NO_ABAP_SPOOLJOB     = 1
          ERR_NO_SPOOLJOB          = 2
          ERR_NO_PERMISSION        = 3
          ERR_CONV_NOT_POSSIBLE    = 4
          ERR_BAD_DESTDEVICE       = 5
          USER_CANCELLED           = 6
          ERR_SPOOLERROR           = 7
          ERR_TEMSEERROR           = 8
          ERR_BTCJOB_OPEN_FAILED   = 8
          ERR_BTCJOB_SUBMIT_FAILED = 9
          ERR_BTCJOB_CLOSE_FAILED  = 10
          others                   = 11.
      if sy-subrc EQ 0.
        LOOP AT witab INTO itab.
          CONCATENATE
            output
            itab-tdline
          INTO output in character mode.
        ENDLOOP.
    endif.
    *write : output.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
            EXPORTING
                text   = output
                mimetype =   'APPLICATION/PDF'
            IMPORTING
                buffer = outputx.
    *concatenate cl_abap_char_utilities=>byte_order_mark_little
    *outputx
    *into outputx in byte mode.
    CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg = 1.
    some Browsers have caching problems when loading Excel Format
      response->set_header_field( name = 'content-type' value =
    'APPLICATION/PDF'  ).
      response->delete_header_field( name =
    if_http_header_fields=>cache_control ).
      response->delete_header_field( name = if_http_header_fields=>expires
      response->delete_header_field( name = if_http_header_fields=>pragma )
        l_pdf_len = xstrlen( outputx ).
        cached_response->set_data( data   = outputx
                            length = l_pdf_len ).
        cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                           value = 'application/pdf' ).
        cached_response->set_status( code = 200 reason = 'OK' ).
        cached_response->server_cache_expire_rel( expires_rel = 180 ).
        CALL FUNCTION 'GUID_CREATE'
          IMPORTING
            ev_guid_32 = guid.
        CONCATENATE runtime->application_url '/' guid '.pdf' INTO l_display_url.
        cl_http_server=>server_cache_upload( url      = l_display_url
                                             response = cached_response ).
    RETURN.
    My Coding Ends----
    Any Further help on this.
    Regards
    Amit Agrawal

  • Applying presets causes filter settings to get corrupted if process version updated

    I have an ongoing problem with Lightroom 5.7 including earlier versions.  The problem occurs when editing photos which use previous process versions (ie, 2010).  My presets all have the Current Process version checked (as they should).  Whenever I apply any preset to a photo, the settings for existing filters get corrupted (reset to 0).  This includes my Graduated Filter settings, Adjustment Brush settings and Radial Filter settings.  Those filters and their masks remain on the photo but their parameters have all been set to zero.  I keep falling into this trap since it's natural to use my presets when making updates to photos.  Often I don't realize this occurred until it's too late. 
    As a work-around (inconvenient) I can first manually update to the current process by right-clicking the photo and saying Settings/Update to Current Process (2012).  Or by clicking the Lightening Bolt button in the upper right corner.  But this must be done prior to applying any presets and I typically for get as my database has tens of thousands of pics. Even a preset with just the Process Version set will cause the filter settings to be corrupted.  I'm not interested in applying a batch or Quick Develop process to all at once since I need to inspect each one as the process is updated.  It would be great if this could be fixed in a maintenance release since it keeps biting me.  I think it's important that this be fixed in LR 6.0 also.  No doubt it's messed up many user's photos without them realizing it.  Does anyone know a work-around so Presets can be used?
    System: Win7 pro 64 (current), 4.2 GHz i7, 12GB, Lightroom 5.7.

    In my opinion: not a good idea to convert old photos en-batch.
    Recommend: convert (hand-selected photos) one at a time, or just use PV2012 on new photos.
    There are more than one reason:
    * As you know, process conversion yields very different results (if photo has been substantially edited).
    * It takes some time to polish your PV2012 editing skills.
    * Often when you are comparing PV2012 results to previous PV2010 results (which you've become familiar with, and like...), you may interpret differences in a more negative light, than if you were using PV2012 without comparing to a previous PV2010 version.
    This last one can not be over-stated. Numerous times I have converted and been disappointed, at least initially. Recovered highlights can seem like loss of contrast. Detail in shadows can be distracting after initial conversion, until you step back for a while, then re-look at it...
    Also, the process version itself (results I mean) takes some getting used to (even when not comparing to a previous legacy-pv edit). e.g. if you've become attached to the over-saturated shadows in previous process version, the shadows seem under-saturated in PV2012, etc...
    Rob

  • No privileges on system tablespace?

    I am a new dba & have succesfully created tables and added constraints.
    Today I tried to add a constraint to an existing table, and received the message
    ORA-01950: no privileges on tablespace 'SYSTEM'
    I tried to add the constraint as the owner of the table, as a user with granted privs on the table, and finally as SYS, and get the same error.
    The system tablespace is only about 60% full, and I have not changed any user privs since I last sucessfully added constraints.
    If someone would give me a clue as to what's going on, I would really appreciate it.
    Thanks, Helen

    I granted unlimited tablespace to the user that owns the table, and the constraint was added successfully.
    I don't know if a user should have unlimited tablespace on SYSTEM...any advice on what a good limit would be? My system tablespace is 325 M and about 60% full. Would it make sense to grant sys unlimited tablespace on SYSTEM?
    Thanks very much for your help. You gave me the incentive to keep trying things until something worked.

Maybe you are looking for