Search This Blog

Thursday, August 11, 2011

RMAN-06023 no backup or copy of datafile found to restore


If we initiate a RESTORE database with a BACKUP controlfile defining  Flash Recovery Area , RMAN execute and implicit crosscheck and catalog of entire objects within the Flash Recovery Area.

RMAN catalogs any objects within the Flash Recovery Area which can not be registered within the controlfile and if any of this files belongs to an incarnation different from CURRENT incarnation within the controlfile then changes controlfile CURRENT incarnation to the one found within the file that's being cataloged.


This avoids database from restoring backups that belong to old CURRENT incarnation.


RMAN reckon with backup available for being restored if the backup incarnation and CURRENT incarnation in controlfile are identical .

Wednesday, August 3, 2011

Start/Stop a communication channel from an ABAP program using the external control switch

This blog only provides instructions on the way to start/stop a channel using an ABAP program. All other steps to possess a totally functional channel aren't provided during this blog, attend http://wiki.sdn.sap.com/wiki/display/XI/Step-by-Step+Guides or do an enquiry on SDN to urge a suggestion on that.

Scenario:-

 There is a scheduled job running daily/weekly that makes an outbound enter SAP ECC

 There is a channel in SAP PI scheduled to select up the file created and send it to an external system

By following the instructions below, the report can then be included as a step during a job scheduled in SAP ECC and thus the channel scheduling in PI will not be required.

 External Control Off

In the communication channel monitoring, select the relevant commnunication channel and click on External Control Switch to allow the communication channel to be started/stopped externally. When it’s turned on, it should look as below.

External Control On

Goto SE38 to make a report and paste the code below.

report YTEST_PRGM line-size 1023 message-id Z002.

data: V_URL type STRING,

 CLIENT type ref to IF_HTTP_CLIENT.

data: RESPONSE_CODE type SYSUBRC,

 RESPONSE_TEXT type STRING.

data: FIELDS_TAB type TIHTTPNVP,

 STATUS_CODE type STRING,

 STATUS_REASON type STRING,

 NUMBER type I.

data: W_RESULT type STRING,

 RESULT_TAB type table of STRING,

 RESULT_WA like line of RESULT_TAB.

"Get comm channel status

V_URL = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=status'.

"Start comm channel

"v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=start'. 

"Stop comm channel

"v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=stop'. 

call method CL_HTTP_CLIENT=>CREATE

 exporting

 HOST = HOST "PI system name

 SERVICE = SERVICE "Port number

* PROXY_HOST =

* PROXY_SERVICE =

* SCHEME = SCHEMETYPE_HTTP

* SSL_ID =

* SAP_USERNAME =

* SAP_CLIENT =

 importing

 CLIENT = CLIENT

 exceptions

 ARGUMENT_NOT_FOUND = 1

 PLUGIN_NOT_ACTIVE = 2

 INTERNAL_ERROR = 3

 others = 4.

if SY-SUBRC 0.

 message E000 with SY-SUBRC.

endif.

*set header fields

call method CLIENT->REQUEST->SET_HEADER_FIELD

 exporting

 NAME = '~request_method'

 VALUE = 'POST'.

call method CLIENT->REQUEST->SET_HEADER_FIELD

 exporting

 NAME = 'Content-Type'

 VALUE = 'application/xml'. "; charset=UTF-8' .

*Set request protocol

call method CLIENT->REQUEST->SET_HEADER_FIELD

 exporting

 NAME = '~server_protocol'

 VALUE = 'HTTP/1.0'.

*Update url

call method CLIENT->REQUEST->SET_HEADER_FIELD

 exporting

 NAME = '~request_uri'

 VALUE = V_URL.

*Disable logon popup

CLIENT->PROPERTYTYPE_LOGON_POPUP = CLIENT->CO_DISABLED.

call method CLIENT->AUTHENTICATE

 exporting

 USERNAME = USERNAME "Username

 PASSWORD = PASSWORD "Password

CL_HTTP_UTILITY=>SET_REQUEST_URI( REQUEST = CLIENT->REQUEST

 URI = RESPONSE_TEXT ).

*Send http request to server

call method CLIENT->SEND

 exceptions

 HTTP_COMMUNICATION_FAILURE = 1

 HTTP_INVALID_STATE = 2

 HTTP_PROCESSING_FAILED = 3

 others = 4.

if SY-SUBRC 0.

 call method CLIENT->GET_LAST_ERROR

 importing

 CODE = RESPONSE_CODE

 message = RESPONSE_TEXT.

 message I000(SR) with RESPONSE_TEXT.

 exit.

endif.

*Get http response from server

call method CLIENT->RECEIVE

 exceptions

 HTTP_COMMUNICATION_FAILURE = 1

 HTTP_INVALID_STATE = 2

 HTTP_PROCESSING_FAILED = 3

 others = 4.

if SY-SUBRC 0.

 call method CLIENT->GET_LAST_ERROR

 importing

 CODE = RESPONSE_CODE

 message = RESPONSE_TEXT.

 STATUS_CODE = CLIENT->RESPONSE->GET_HEADER_FIELD( '~status_code' ).

 STATUS_REASON = CLIENT->RESPONSE->GET_HEADER_FIELD( '~status_reason' ).

 concatenate RESPONSE_TEXT '(' STATUS_CODE STATUS_REASON ')'

 into STATUS_REASON separated by SPACE.

 message I000(SR) with STATUS_REASON.

 exit.

endif.

*Get header_fields contents such status code, reason etc

"call method client->response->GET_HEADER_FIELDS

" changing

" FIELDS = Fields_Tab .

clear: W_RESULT.

W_RESULT = CLIENT->RESPONSE->GET_CDATA( ).

refresh RESULT_TAB.

split W_RESULT at CL_ABAP_CHAR_UTILITIES=>NEWLINE into table RESULT_TAB.

loop at RESULT_TAB into RESULT_WA.

 write / RESULT_WA.

endloop.

The following variables should be assigned with proper values:-

Host-PI system name

Service-PI system port number

Username-This must be a user in PI system with the subsequent roles: xi_af_channel_admin_display and xi_af_channel_admin_modify

Password-PI user’s password

"Starting the communication channel

v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=start'.

"Stopping communication channel

v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=stop'.

"Get communication channel status

v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=status'.

URL Parameters 

http(s)://host:port/AdapterFramework/ChannelAdminServlet?party=party&service=service&channel=channel&action=action

party- Recognize the party of the channel to be organized. You can use an asterisk (*) as a placeholder to administer various channels simultaneously

service- Recognizes the communication component of the channel to be administered. You can use an asterisk (*) as a placeholder to administer various channels concurrently

channel- Recognizes the name of the channel to be administered. You can use an asterisk (*) as a placeholder to administer various channels concurrently. 

Action- you utilize the beginning and stop actions to start out and stop the channels. You can use the status action to query the status of 1 or more channels.

Reorganizing Tables with BR*Tools

Use

BR*Tools can be used to reorganize tables online for Oracle database in SAP system.

Note

This article gives an overview on the procedure to reorganize a table with BR*Tools.

For more information on the approach to table reorganization, see:

· Reorganization

· Reorganization Case Study

You can perform the following types of reorganization:

· Reorganize tables online

· Check tables for reorganization

· Clean up tables after aborted reorganization

· Conversion of LONG and LONG RAW fields to CLOB or BLOB online in Oracle 10g or higher

· Stop reorganization (command-line mode only)

· Suspend reorganization (command-line mode only)

· Resume reorganization (command-line mode only)

For more information, see -f tbreorg.

Prerequisites

You cannot perform online reorganization for tables with LONG or LONG RAW fields but you'll convert them to CLOB or BLOB online. After this conversion, you'll reorganize all tables online. For more information, see SAP Note 646681.

Procedure

1. From the command line, start the procedure using BRGUI or BRTOOLS, or :

 BRGUI or BRTOOLS:

i. Choose Segment Management ® Reorganize tables.

BRGUI or BRTOOLS displays the menu BRSPACE options for reorganization of tables, where you specify the choices with which you call BRSPACE.

ii. Set the required options:

Note

If required, in Table names you'll enter the names of multiple tables. You can use wildcards. For more information, look in to “Selecting Objects“ in Segment Management with BR*Tools. You can also specify a list of tables to be processed with reorg_table in the initialization profile init.sap.

In Tablespace names and Table owner, you'll specify multiple objects but you can't use wildcards. BRSPACE processes all the tables within the specified tablespace name(s) or all tables belonging to the required table owner(s). But these entries and reorganization action entry are not mandatory.

iii. Choose Continue.

BRGUI or BRTOOLS prompts you to start BRSPACE.

iv. Choose Continue to start BRSPACE.

¡ Command line:

Enter at least the following command:

brspace –f tbreorg

You can go with additional parameters, including the table names, if required. we can see BRSPACE -f tbreorg for more information.

Note

Whichever way you begin the procedure – with BRGUI or BRTOOLS, or from the instruction – you'll use quick mode if you recognize the ultimate object names, in this case the table names. For more information, see How to Use BR*Tools.

BRSPACE starts and you see a message that has Start of BRSPACE processing. From now on, BRSPACE writes a detail log.

2. If you've got already entered the table names, continue with step 5 (quick mode).

Note

If you've got entered multiple tables, BRSPACE displays as confirmation an inventory of tables for reorganization. If you've got not already made a final selection, you'll make a variety from this list.

Continue with step 5 (quick mode).

BRSPACE displays the Table reorganization main menu.

3. Choose Reorganize tables.

BRSPACE displays the table list:

4. Select a table or multiple tables.

Example

These examples only apply for character mode inputs..

To choose the first three tables within the list, enter 1-3.

To choose the first and third tables, enter 1,3.

To choose the first three tables and therefore the fifth, enter 1-3,5.

To choose all tables, enter 0.

BRSPACE will show the  Options for reorganization of tables.

5. Set the required options:

Note

There is no SQL instruction here because the reorganization is performed in several steps by an Oracle package, which contains multiple procedures.

6. to start out processing with the chosen options, choose Continue.
Results

Check the results in the BRSPACE logs.

· The summary log space.logdisplays the return code.

· The detail log s.tbr displays the details.

For more information on the way to view the logs with BR*Tools, see Showing Logs and Profiles with BR*Tools.

The file ddl.sql is created in the subdirectory of the directory $SAPDATA_HOME/sapreorg if the option –d|-ddl is set to a value other than no. The file contains the Data Definition Language (DDL) statements used for the creation of interim tables during the reorganization. For more information, see Reorganization. If the –d|-ddl option is about to only, then only DDL statements are created and therefore the actual reorganization isn't performed