Relocating objects into new tablespace?
I was looking for an easy way to relocate all objects from one table space to another table space? Is there a utility or any way to have all objects in one table space move to a new tablespace with out have to either move or rebuild each object one at a time.
We have a tablespace that is 50 gig but is only 2% utilized so I am looking to shrink the overall db size by relocating the objects, and the dropping the 50 gig table space.
I am trying to avoid extracting all of the ddl for all of the objects as well as the ddl to rebuild all of the indexes as there are over 200 objects that need relocating?
Thanks.
HI..
To relocate the tables into another tablespace you can spool the output of below query and run it.
select 'alter table '||owner||'.'||table_name||' move tablespace new_tbs_name parallel N;' from dba_tables where tablespace_name='XXX';
Note:- N = cpu_count-1
parallel --> to fasten the activity
After its done,
Rebuild the indexes of these tables:-
select 'alter index '||owner||'.'||index_name||' rebuild parallel N;' from dba_indexes where table_name in (select table_name from dba_tables where tablespace_name='XXX');
Then change the degree back:--
select 'alter table '||owner||'.'||table_name||' parallel (degree 1);' from dba_tables where degree > 1;
select 'alter index '||owner||'.'||index_name||' parallel (degree 1);' from dba_indexes where degree > 1;
If on 10g
select 'alter table '||owner||'.'||table_name||' parallel (degree 1);' from dba_tables where degree > '1';
select 'alter index '||owner||'.'||index_name||' parallel (degree 1);' from dba_indexes where degree > '1';
HTH
Anand
Similar Messages
-
Moving objects into different tablespaces
Hi Gurus,
Here is my query .
I have 40gb space to have dataset from production database.
Test enviornment will be refreshed with production database.
From testing enviornment development will be refreshed to aviod any connections to production.
As part of data copying to dev env is depending on the conditions given by business.
So my question comes here
Initially I will be dumpring all the data to one tablespace in one tablespace of development environment.
It could take 39 to 40GB.
Now i want to move objects into different tablespaces accoring to storage clause and no of records .
New tablespaces will be created in development enviornment and will be created in same 40GB.
Space is constraint in dev env and cann't be extended.
How can i create tablespaces into the dev env and move objects into them?
I hope you understood my queries ...
In simple
TESTING ENV - - - -- - - - > DEV ENV(Initially one tablespace for all tables/objects) - - -- -- ---- >DEV ENV(Objects in diiferent tablespaces )You say:
While creating scripts of tables we are removing all tablespace names as we will be having 3 tablespaces at target that is also after loading the data into them.Don't remove the TS clause, but replace the TS so-and-so with TS that-and-that.
Or replace tablespaces a, b and c with x+, and d* and e with y*+.
This can be automated, but you will have to write some logic for that.
Because ... we will be having only 3 tablespaces in DEV. ex NEWYORK tablespace is in production but it won't be created in DEv , istead all the objects into that tablespace will be moved to large table space.
As I said: You will need a code which greps for TS NEWYORK* and replaces it with +<your_big_TS>+.
So once again: Where is the problem?
It's just a question of coding. -
Shifting DB Objects into new table space
Hi Guys,
We did not create any tablespace and all the users and their objects that we have created so far are in system tablespace...
Now we have created a tablespace. How can we shift our objects, users and their tables, view, packages, triigers in new tablespace.
Please explain with example if possible. And how to delete the objects from system tablespace. Please explain in details.
Looking forward for your kind help.
Imran BaigWhat about the packages, procedures and functions.Those objects, as views does not own a Data Segment, their definition is stored in system catalog. There's nothing you need to do, that's 100% OK.
is this commans necessary to run after all the tables are in new tablespace?
alter index xyz rebuild onlineYes. In fact, when moving a table, rebuilding its indexes must be done. As for me, it's best to rebuild the indexes just after the table is moved. You can create a package or procedure to do this.
Oh, bah, I can give you some code sample. It's a package I created some time ago that can generate object movement code depending on their size to move them to appropriately sized tablespaces (extent size, etc):create or replace PACKAGE MGTSPACE
IS
-- Record qui permet de définir les bornes hautes/basse par tablespace.
TYPE tMinMax IS RECORD
minsize NUMBER(38),
maxsize NUMBER(38)
-- Tableau stockant les valeurs par indexation par nom de tablespace
TYPE tTS_MinMax IS TABLE
OF tMinMax
INDEX BY VARCHAR2(30);
-- Variable qui va stocker les diférentes valeurs de bornage
vTS_MinMax tTS_MinMax;
-- Type qui va stocker la liste des tablespaces à gérer
TYPE tListeChaine IS TABLE
OF VARCHAR2(30)
INDEX BY BINARY_INTEGER;
-- Variable qui stocke la liste des tablespaces à gérer
vListeTablespace tListeChaine;
-- Procédure d'initialisation
PROCEDURE INIT;
-- Procédure de recherche des tables dans un tablespace spécifique
PROCEDURE TS_SCAN(pTSname IN VARCHAR2);
-- Procédure de recherche des tables dans l'ensemble des tablespaces configurés
PROCEDURE TS_SCAN_ALL;
END;
create or replace PACKAGE BODY MGTSPACE
IS
-- Procédure d'initialisation
PROCEDURE INIT
IS
BEGIN
vTS_MinMax('DATBIG').minsize := 1536;
vTS_MinMax('DATBIG').maxsize := 1000000;
vTS_MinMax('DAT').minsize := 20;
vTS_MinMax('DAT').maxsize := 1536;
vTS_MinMax('DATLOW').minsize := 0;
vTS_MinMax('DATLOW').maxsize := 20;
vTS_MinMax('IDXBIG').minsize := 1000000;
vTS_MinMax('IDXBIG').maxsize := 512;
vTS_MinMax('IDX').minsize := 100;
vTS_MinMax('IDX').maxsize := 512;
vTS_MinMax('IDXLOW').minsize := 0;
vTS_MinMax('IDXLOW').maxsize := 100;
vListeTablespace(1):='DATBIG';
vListeTablespace(2):='DAT';
vListeTablespace(3):='IDXBIG';
vListeTablespace(4):='IDX';
vListeTablespace(5):='IDXLOW';
vListeTablespace(6):='DATLOW';
END;
-- Déplace une partition d'index
PROCEDURE MOVE_INDEX_PARTITION(pOwner IN VARCHAR2, pName IN VARCHAR2, pDestination IN VARCHAR2, pPartName IN VARCHAR2)
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('ALTER INDEX ' || pOwner || '.' || pName || ' REBUILD PARTITION ' || pPartName || ' TABLESPACE ' || pDestination || ' ONLINE COMPUTE STATISTICS;');
END;
-- Procédure de déplacement d'un index
PROCEDURE MOVE_INDEX(pOwner IN VARCHAR2, pName IN VARCHAR2, pDestination IN VARCHAR2 := NULL)
IS
BEGIN
IF (pDestination IS NOT NULL) THEN
DBMS_OUTPUT.PUT_LINE('ALTER INDEX ' || pOwner ||'.' || pName || ' REBUILD TABLESPACE ' || pDestination || ' NOLOGGING ONLINE STORAGE (INITIAL 128k) COMPUTE STATISTICS;');
ELSE
DBMS_OUTPUT.PUT_LINE('ALTER INDEX ' || pOwner ||'.' || pName || ' REBUILD NOLOGGING ONLINE COMPUTE STATISTICS;');
END IF;
END;
-- Procédure de déplacement d'une table
PROCEDURE MOVE_TABLE(pOwner IN VARCHAR2,pName IN VARCHAR2, pDestination IN VARCHAR2)
IS
BEGIN
-- Génération du code de déplacement
DBMS_OUTPUT.PUT_LINE('ALTER TABLE ' || pOwner || '.' || pName || ' MOVE TABLESPACE ' || pDestination || ' STORAGE(INITIAL 128k);');
-- Reconstruction des indexes associés
FOR vListeIndexes IN (SELECT OWNER, INDEX_NAME FROM DBA_INDEXES WHERE TABLE_NAME=pName AND OWNER=pOwner)
LOOP
MOVE_INDEX(vListeIndexes.OWNER, vListeIndexes.INDEX_NAME);
END LOOP;
END;
-- Procédure qui propose le déplacement d'un objet
PROCEDURE MOVE_OBJECT(pType IN VARCHAR2,pOwner IN VARCHAR2,pName IN VARCHAR2, pPartName IN VARCHAR2,pDestination IN VARCHAR2,pSize IN NUMBER)
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('--');
DBMS_OUTPUT.PUT_LINE('-- Doit déplacer l''objet ' || pType || ' ' || pOwner || '.' || NVL(pPartname,pName) || (CASE WHEN pPartName IS NOT NULL THEN ' partition de ' || pName ELSE NULL END) || ' vers ' || pDestination || '. Taille: ' || pSize || 'MiB');
IF (pType = 'TABLE') THEN
MOVE_TABLE(pOwner, pName, pDestination);
ELSIF (pType = 'INDEX') THEN
MOVE_INDEX(pOwner, pName, pDestination);
ELSIF (pType = 'INDEX PARTITION') THEN
MOVE_INDEX_PARTITION(pOwner, pName, pDestination, pPartName);
ELSE
DBMS_OUTPUT.PUT_LINE('Type d''objet non géré. ' || pOwner || '.' || pName || ' est de type: ' || pType||'/'||pPartName);
END IF;
DBMS_OUTPUT.PUT_LINE('--');
DBMS_OUTPUT.PUT_LINE('--');
END;
-- Procédure de recherche des tables dans un tablespace spécifique
PROCEDURE TS_SCAN(pTSname IN VARCHAR2)
IS
CURSOR cObjList IS
SELECT OWNER, SEGMENT_NAME, PARTITION_NAME, BYTES/1024/1024 ACT_SIZE, SEGMENT_TYPE
FROM DBA_SEGMENTS
WHERE TABLESPACE_NAME=pTSname
AND (BYTES/1024/1024 < vTS_MinMax(pTSname).minsize OR BYTES/1024/1024 >= vTS_MinMax(pTSname).maxsize);
BEGIN
-- On traite le tablespace passé en paramètre
DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE('-- Traitement du tablespace ' || pTSname || '('||vTS_MinMax(pTSname).minsize||'/'||vTS_MinMax(pTSname).maxsize||')');
DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------');
-- Et on recherche tous les objets concernés
FOR vObjList IN cObjList
LOOP
-- Cet objet est mal placé, on cherche ou il doit être relocalisé
FOR vTSidx IN vListeTablespace.FIRST .. vListeTablespace.LAST
LOOP
-- On vérifie l'existence de l'entrée: précaution :)
IF vListeTablespace.EXISTS(vTSidx) THEN
-- Si c'est la même catégorie
IF ((SUBSTR(vListeTablespace(vTSidx),1,3) = SUBSTR(pTSname,1,3)) AND (vObjList.ACT_SIZE BETWEEN vTS_MinMax(vListeTablespace(vTSidx)).minsize AND vTS_MinMax(vListeTablespace(vTSidx)).maxsize))THEN
MOVE_OBJECT(vObjList.SEGMENT_TYPE,vObjList.OWNER,vObjList.SEGMENT_NAME,vObjList.PARTITION_NAME,vListeTablespace(vTSidx),vObjList.ACT_SIZE);
END IF;
END IF;
END LOOP;
END LOOP;
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------');
END;
-- Procédure de recherche des tables dans l'ensemble des tablespaces configurés
PROCEDURE TS_SCAN_ALL
IS
BEGIN
FOR vTSidx IN vListeTablespace.FIRST .. vListeTablespace.LAST
LOOP
IF vListeTablespace.EXISTS(vTSidx) THEN
TS_SCAN(vListeTablespace(vTSidx));
END IF;
END LOOP;
END;
END;Comments are in French, but you can guess :-)
You'll have to modify PROCEDURE INIT in order to set up YOUR tablespace names. For example, you'll have to add an entry in the table for the SYSTEM tablespace!
This is called using:SET SERVEROUTPUT ON SIZE 200000
BEGIN
MGTSPACE.INIT;
MGTSPACE.TS_SCAN_ALL;
END;
/Modify it to suit your needs, but you shouldn't have much work to do. For example, PROCEDURE INIT, for you, will be like:PROCEDURE INIT
IS
BEGIN
vTS_MinMax('DAT').minsize := 0;
vTS_MinMax('DAT').maxsize := 10000000;
vTS_MinMax('IDX').minsize := 0;
vTS_MinMax('IDX').maxsize := 10000000;
vTS_MinMax('SYSTEM').minsize := 0;
vTS_MinMax('SYSTEM').maxsize := 0;
vListeTablespace(1):='SYSTEM';
vListeTablespace(2):='DAT';
vListeTablespace(3):='IDX';
END;Note : This will generate the code, not run it.
Note2: This code assumes that tables tablespace names start with DAT and that index tablespace names start with IDX.
Note3: I know separating tables and indexes is useless, just some personnal organisation choice :-)
Note4: To avoid that (and you have to, because SYSTEM does not match) , change the code:IF ((SUBSTR(vListeTablespace(vTSidx),1,3) = SUBSTR(pTSname,1,3)) AND (vObjList.ACT_SIZE BETWEEN vTS_MinMax(vListeTablespace(vTSidx)).minsize AND vTS_MinMax(vListeTablespace(vTSidx)).maxsize))THEN
MOVE_OBJECT(vObjList.SEGMENT_TYPE,vObjList.OWNER,vObjList.SEGMENT_NAME,vObjList.PARTITION_NAME,vListeTablespace(vTSidx),vObjList.ACT_SIZE);
END IF;
to
IF ((vObjList.ACT_SIZE BETWEEN vTS_MinMax(vListeTablespace(vTSidx)).minsize AND vTS_MinMax(vListeTablespace(vTSidx)).maxsize))THEN
MOVE_OBJECT(vObjList.SEGMENT_TYPE,vObjList.OWNER,vObjList.SEGMENT_NAME,vObjList.PARTITION_NAME,vListeTablespace(vTSidx),vObjList.ACT_SIZE);
END IF; in procedure TS_SCAN
Note5: well, I'll let you do the remaining :-)
Note6: This is not optimized code, nor guaranteed.
Note7: Nothing to see here, move along.
Regards,
Yoann. -
Splitting objects of a schema into 2 tablespaces
Hi is it possible in Oracle database to split a schema objects into 2 tablespaces (or more)?
I am trying to export and then import a schema to another machine but getting a : tablespace APEX_XXXXXX does not exist error. About 4 tables and respective constraints chucked this error while everything else got imported successfully.
I have granted quota unlimited on the tablespace when I created user.
I didnt' think it was possible but can't see why it would look for that APEX_xxxx tablespace for those particular tables. Exporting gave no errors btw.
Using Oracle Database 11G R2.Thanks for your replies.
Basically I am going to move objects from SYSTEM tablespace to a designated one called APEX_XXXX (later on). But trying to import into a local machine before I get into that.
Now looks like few of them already exist in APEX_XXXXX, so I need to move the rest across. I prefer to use REMAP_TABLESPACE option of Data Pump as Oracle docs recommend it as a cleaner way to move schema & objects from A to B.
However, would it have any implications if some tables already exists in APEX_XXXX tablespace?
I am planning to do something like this
impdb system/system schemas=lsprod REMAP_TABLESPACE=SYSTEM:APEX_XXXX logfile=export.logThank you.
here is the first 10 lines of the original import.
Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
Export file created by EXPORT:V11.02.00 via conventional path
Warning: the objects were exported by LSPROD, not by you
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses US7ASCII character set (possible charset conversion) -
One Transport request objects copy into new transport request
Dear Experts,
I created a transport request under which i saved my objects. <b>Now i need to copy old request objects into new request or split that transport request into number of new transport requests.</b> First of all It is possible or not , if it is possible please tell me the solution how to do.
Regards,
KrishnaHello Krishna
You can
(1) add object lists of already released requests ("old" requests) to you current request (still changeable)
(2) merge changeable transport requests together
(3) split a changeable request into several requests
Whereas (1) and (2) are supported by standard functions of the SAP system (3) is a manual task involving the following steps:
a.) Create a new request
b.) Copy required transport entries (e.g. R3TR TABL ZMYTABLE) from one request to the new request
c.) Delete all copied transport entries from the object list of the "first" request
However, if you are not fully aware of the dependencies between different transport object entries the splitting of object lists may cause hassle when you import the splitted requests into the next SAP system.
Regards
Uwe -
How to determine the object in the tablespace
Hi
I have a problem with my database, How can i determine the object in the tablespace
and how do move old tablespace into new tablespace and how to drop existing tablespace.
ThanksHi,
If you want to find for all objects information, you can use dba_segments and filter this against the tablespace name. Once done you can create another tablespace and move the objects from old tablespace to new tablespace. Later you can drop the old tablepspace. You can use the below mention commands also:
SELECT 'ALTER TABLE '|| table_name ||' MOVE TABLESPACE USERS;'
FROM user_tables WHERE tablespace_name='MY_TableSpace';
SELECT 'ALTER INDEX '|| index_name ||' REBUILD TABLESPACE USERS;'
FROM user_indexes WHERE tablespace_name='MY_TableSpace';
SELECT 'ALTER TABLE '|| table_name ||' MOVE LOB ('
|| column_name ||') STORE AS (TABLESPACE USERS);'
FROM user_lobs WHERE tablespace_name='MY_TableSpace';
On the other hand,
You can also export a backup of the source tablespace and import into the target tablespace.
Regards,
XIC -
Autoextend tablespace into new file
I have a small program that captures images and from time to time the users fill up the image tablespace and I have to manually create a new tablespace. The way I have it setup is that my image tablespace is set to 2GB (the name of the datafile is /opt/oracle/oradata/image1.dbf). How can I (or CAN I) have Oracle (or my program) automatically create another datafile when space is getting low on the 1st. I thought about creating a bigger file to start with, but I don't want to chew up that much space unless it's needed (some clients need it, some don't).
Edited by: user461089 on Aug 27, 2009 11:52 AMOracle allows data files to autoextend. You can have it automatically increase the size of image1.dbf (or whatever other data files you have in the tablespace). You cannot have Oracle automatically add new data files to a tablespace, though you could certainly write a job (DBMS_JOB or DBMS_SCHEDULER) that would periodically look at the free space in a tablespace and add a data file if there was too little free space. I'm not sure I see the benefit to doing this rather than letting data files grow, though.
Justin -
Problem importing into new 10g db
I am very new to Oracle - so you are warnned!
I installed Oracle 10g and created a new database called alio. I set up a service and a listener.
I now am trying to import a dump of another db. I ran a script before this to make sure alio is structured the same as the dump file, schemas, tablespaces, etc.
I get to this point in the import and then it stops:
Export file created by EXPORT:V10.01.00 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. importing ADM's objects into ADM
No errors or anything, it just stops. Any ideas?Thank you so much for helping me. I found the alert.log file and copied the bottom of the file below:
Thu Sep 27 11:56:32 2007
Memory Notification: Library Cache Object loaded into SGA
Heap size 2137K exceeds notification threshold (2048K)
Details in trace file d:\orant\admin\alio\udump\alio_ora_2288.trc
KGL object name :XDB.XDPhOB200OSSS++CkUwilGXQ==
Thu Sep 27 15:24:09 2007
Thread 1 advanced to log sequence 25
Current log# 1 seq# 25 mem# 0: D:\ORANT\ORA10G\ORADATA\ALIO\REDO01.LOG
Fri Sep 28 04:00:26 2007
Thread 1 advanced to log sequence 26
Current log# 2 seq# 26 mem# 0: D:\ORANT\ORA10G\ORADATA\ALIO\REDO02.LOG
Fri Sep 28 06:00:00 2007
Unable to restore resource manager plan to '':
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00439: feature not enabled: Database resource manager
Fri Sep 28 22:00:11 2007
Thread 1 advanced to log sequence 27
Current log# 3 seq# 27 mem# 0: D:\ORANT\ORA10G\ORADATA\ALIO\REDO03.LOG
Sat Sep 29 06:00:00 2007
Unable to restore resource manager plan to '':
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00439: feature not enabled: Database resource manager
Sat Sep 29 07:00:59 2007
Thread 1 advanced to log sequence 28
Current log# 1 seq# 28 mem# 0: D:\ORANT\ORA10G\ORADATA\ALIO\REDO01.LOG
Sun Sep 30 00:52:51 2007
Thread 1 advanced to log sequence 29
Current log# 2 seq# 29 mem# 0: D:\ORANT\ORA10G\ORADATA\ALIO\REDO02.LOG
Sun Sep 30 21:00:03 2007
Thread 1 advanced to log sequence 30
Current log# 3 seq# 30 mem# 0: D:\ORANT\ORA10G\ORADATA\ALIO\REDO03.LOG
Mon Oct 01 00:00:00 2007
Unable to restore resource manager plan to '':
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00439: feature not enabled: Database resource manager
To do the import I am running a batch file that someone else wrote:
@echo off
REM Set working directory
SET WORKING_DIR=%CD%
REM drop and create user
SET /P database=Enter database name:
SET /P system_pass=Enter database system password:
SET /P user_pass=Enter admin users password (ADM, BPS, etc.):
echo.
:retry
echo Type 'single' if importing from a single dump file or
echo type 'multiple' if importing from user dumps (i.e adm.dmp, fas.dmp, etc.)
echo or type 'exit' to quit.
echo.
set choice='bogus'
set /p choice=
echo.
if '%choice%'=='single' goto single
if '%choice%'=='multiple' goto multiple
if '%choice%'=='exit' goto exit
cls
echo.
echo Not a valid entry
echo.
echo Please enter 'single', 'multiple', or 'exit' to continue
goto retry
:single
echo Enter path to dump file including dump file name (i.e. q:\dmp\dump.dmp).
set /p dmp_path=
echo.
echo ############################################
echo %database% will now be updated with new data
echo ############################################
echo #
echo Press CTRL-C if you do not wish to continue
echo #
pause
sqlplus system/%system_pass%@%database% <"%WORKING_DIR%\dropcreat.txt"
imp system/%system_pass%@%database% file=%dmp_path% full=n ignore=y buffer=40000000 fromuser=adm touser=adm statistics=none
imp system/%system_pass%@%database% file=%dmp_path% full=n ignore=y buffer=40000000 fromuser=shr touser=shr statistics=none
imp system/%system_pass%@%database% file=%dmp_path% full=n ignore=y buffer=40000000 fromuser=fas touser=fas statistics=none
imp system/%system_pass%@%database% file=%dmp_path% full=n ignore=y buffer=40000000 fromuser=hrs touser=hrs statistics=none
imp system/%system_pass%@%database% file=%dmp_path% full=n ignore=y buffer=40000000 fromuser=bps touser=bps statistics=none
imp system/%system_pass%@%database% file=%dmp_path% full=n ignore=y buffer=40000000 fromuser=tea touser=tea statistics=none
imp system/%system_pass%@%database% file=%dmp_path% full=n ignore=y buffer=40000000 fromuser=whs touser=whs statistics=none
goto :exit
:multiple
echo Enter path to dump file (i.e. q:\dmp).
set /p dmp_path=
echo.
echo ############################################
echo %database% will now be updated with new data
echo ############################################
echo #
echo Press CTRL-C if you do not wish to continue
echo #
pause
sqlplus system/%system_pass%@%database% <"%WORKING_DIR%\dropcreat.txt"
imp system/%system_pass%@%database% file=%dmp_path%\adm.dmp full=n ignore=y buffer=40000000 fromuser=adm touser=adm statistics=none
imp system/%system_pass%@%database% file=%dmp_path%\shr.dmp full=n ignore=y buffer=40000000 fromuser=shr touser=shr statistics=none
imp system/%system_pass%@%database% file=%dmp_path%\fas.dmp full=n ignore=y buffer=40000000 fromuser=fas touser=fas statistics=none
imp system/%system_pass%@%database% file=%dmp_path%\hrs.dmp full=n ignore=y buffer=40000000 fromuser=hrs touser=hrs statistics=none
imp system/%system_pass%@%database% file=%dmp_path%\bps.dmp full=n ignore=y buffer=40000000 fromuser=bps touser=bps statistics=none
imp system/%system_pass%@%database% file=%dmp_path%\tea.dmp full=n ignore=y buffer=40000000 fromuser=tea touser=tea statistics=none
imp system/%system_pass%@%database% file=%dmp_path%\whs.dmp full=n ignore=y buffer=40000000 fromuser=whs touser=whs statistics=none
REM compile allsrc
REM sqlplus system/manager@%database% <"%WORKING_DIR%\allsrc.txt"
:exit -
Error in IB (When trying to import objects into ESR from SLD or from server
Hi Experts,
We are facing an error with the Integration builder recently. When we open Enterprise Services Repository of PI 7.1, we are able to see the GUI with objects perfectly. When we try to import an object into the repository from the server ( In ESR, choose Tools -> Import Design objects -> From Server), we are thrown with an exception...
Error when exectuting search (QUERY_ERROR)
& java.lang.NullPointerException
The server throws the above two exceptions. I have pasted the logs of the error when trying to import an object from the server and also from the sld, below.
Have any of you experieced the issue? Request you to please check this out and suggest what the problem could be. Thanks in advance.
Regards,
Basker
Log of the error received when trying to import an object from the server...
====================================================================
= Root Exception ===================================================
====================================================================
Thrown:
com.sap.aii.utilxi.swing.framework.ExecuteException: Error when executing search
at com.sap.aii.ib.gui.shelp.QueryPanel.executeQuery(QueryPanel.java:582)
at com.sap.aii.ib.gui.shelp.QueryPanel.startQuery(QueryPanel.java:595)
at com.sap.aii.ib.gui.shelp.QueryPanel$1.run(QueryPanel.java:218)
at com.sap.aii.utilxi.misc.thread.ThreadPool$ThreadPoolThread.run(ThreadPool.java:392)
Caused by: java.lang.NullPointerException: null
at com.sap.aii.utilxi.core.collections.ArrayUtil.appendArrays(ArrayUtil.java:331)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:273)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:241)
at com.sap.aii.ib.gui.shelp.StandardQueryAccessor.executeQuery(StandardQueryAccessor.java:68)
at com.sap.aii.ib.gui.shelp.QueryPanel.executeQuery(QueryPanel.java:567)
... 3 more
====================================================================
== Content from the LogHandler =====================================
====================================================================
#12 13:44:56 AWT-EventQueue-2 ERROR com.sap.aii.utilxi.swing.toolkit.ExceptionDialog: Throwable
Thrown:
com.sap.aii.utilxi.swing.framework.ExecuteException: Error when executing search
at com.sap.aii.ib.gui.shelp.QueryPanel.executeQuery(QueryPanel.java:582)
at com.sap.aii.ib.gui.shelp.QueryPanel.startQuery(QueryPanel.java:595)
at com.sap.aii.ib.gui.shelp.QueryPanel$1.run(QueryPanel.java:218)
at com.sap.aii.utilxi.misc.thread.ThreadPool$ThreadPoolThread.run(ThreadPool.java:392)
Caused by: java.lang.NullPointerException: null
at com.sap.aii.utilxi.core.collections.ArrayUtil.appendArrays(ArrayUtil.java:331)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:273)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:241)
at com.sap.aii.ib.gui.shelp.StandardQueryAccessor.executeQuery(StandardQueryAccessor.java:68)
at com.sap.aii.ib.gui.shelp.QueryPanel.executeQuery(QueryPanel.java:567)
... 3 more
#11 13:44:55 Pool-Thread-0 FINE AutoLog.created.java.lang.NullPointerException: java.lang.NullPointerException
at com.sap.aii.utilxi.core.collections.ArrayUtil.appendArrays(ArrayUtil.java:331)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:273)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:241)
at com.sap.aii.ib.gui.shelp.StandardQueryAccessor.executeQuery(StandardQueryAccessor.java:68)
at com.sap.aii.ib.gui.shelp.QueryPanel.executeQuery(QueryPanel.java:567)
at com.sap.aii.ib.gui.shelp.QueryPanel.startQuery(QueryPanel.java:595)
at com.sap.aii.ib.gui.shelp.QueryPanel$1.run(QueryPanel.java:218)
at com.sap.aii.utilxi.misc.thread.ThreadPool$ThreadPoolThread.run(ThreadPool.java:392)
#10 13:44:55 Pool-Thread-0 DEBUG AutoLog.created.java.lang.NullPointerException: null
#9 13:44:55 Pool-Thread-0 FINE AutoLog.created.com.sap.aii.utilxi.swing.framework.ExecuteException: com.sap.aii.utilxi.swing.framework.ExecuteException: Error when executing search
at com.sap.aii.ib.gui.shelp.QueryPanel.executeQuery(QueryPanel.java:582)
at com.sap.aii.ib.gui.shelp.QueryPanel.startQuery(QueryPanel.java:595)
at com.sap.aii.ib.gui.shelp.QueryPanel$1.run(QueryPanel.java:218)
at com.sap.aii.utilxi.misc.thread.ThreadPool$ThreadPoolThread.run(ThreadPool.java:392)
Caused by: java.lang.NullPointerException
at com.sap.aii.utilxi.core.collections.ArrayUtil.appendArrays(ArrayUtil.java:331)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:273)
at com.sap.aii.ib.gui.xiitem.services.XiItemServiceProvider.queryXiItems(XiItemServiceProvider.java:241)
at com.sap.aii.ib.gui.shelp.StandardQueryAccessor.executeQuery(StandardQueryAccessor.java:68)
at com.sap.aii.ib.gui.shelp.QueryPanel.executeQuery(QueryPanel.java:567)
... 3 more
#8 13:44:55 Pool-Thread-0 DEBUG AutoLog.created.com.sap.aii.utilxi.swing.framework.ExecuteException: Error when executing search
#7 13:43:52 AWT-EventQueue-2 FINE AutoLog.created.com.sap.engine.services.security.exceptions.BaseLoginException: com.sap.engine.services.security.exceptions.BaseLoginException: Authentication did not succeed.
at com.sap.engine.services.security.server.jaas.BasicPasswordLoginModule.login(BasicPasswordLoginModule.java:149)
at com.sap.engine.services.security.login.LoginModuleLoggingWrapperImpl.login(LoginModuleLoggingWrapperImpl.java:220)
at com.sap.engine.services.security.login.ModulesProcessAction.run(ModulesProcessAction.java:70)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.services.security.login.FastLoginContext.login(FastLoginContext.java:218)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImpl.login(RemoteLoginContextHelperImpl.java:78)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImplp4_Skel.dispatch(RemoteLoginContextHelperImplp4_Skel.java:64)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
predecessor system
com.sap.engine.services.security.exceptions.BaseLoginException: Authentication did not succeed.
at com.sap.engine.services.security.server.jaas.BasicPasswordLoginModule.login(BasicPasswordLoginModule.java:149)
at com.sap.engine.services.security.login.LoginModuleLoggingWrapperImpl.login(LoginModuleLoggingWrapperImpl.java:220)
at com.sap.engine.services.security.login.ModulesProcessAction.run(ModulesProcessAction.java:70)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.services.security.login.FastLoginContext.login(FastLoginContext.java:218)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImpl.login(RemoteLoginContextHelperImpl.java:78)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImplp4_Skel.dispatch(RemoteLoginContextHelperImplp4_Skel.java:64)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
#6 13:43:52 AWT-EventQueue-2 DEBUG AutoLog.created.com.sap.engine.services.security.exceptions.BaseLoginException: Authentication did not succeed.
#5 13:43:52 AWT-EventQueue-2 FINE AutoLog.created.com.sap.engine.services.security.exceptions.BaseLoginException: com.sap.engine.services.security.exceptions.BaseLoginException: Cannot authenticate the user.
at com.sap.engine.services.security.login.ModulesProcessAction.run(ModulesProcessAction.java:175)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.services.security.login.FastLoginContext.login(FastLoginContext.java:218)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImpl.login(RemoteLoginContextHelperImpl.java:78)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImplp4_Skel.dispatch(RemoteLoginContextHelperImplp4_Skel.java:64)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
Caused by: com.sap.engine.services.security.exceptions.BaseLoginException: Authentication did not succeed.
at com.sap.engine.services.security.server.jaas.BasicPasswordLoginModule.login(BasicPasswordLoginModule.java:149)
at com.sap.engine.services.security.login.LoginModuleLoggingWrapperImpl.login(LoginModuleLoggingWrapperImpl.java:220)
at com.sap.engine.services.security.login.ModulesProcessAction.run(ModulesProcessAction.java:70)
... 13 more
predecessor system
com.sap.engine.services.security.exceptions.BaseLoginException: Cannot authenticate the user.
at com.sap.engine.services.security.login.ModulesProcessAction.run(ModulesProcessAction.java:175)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.services.security.login.FastLoginContext.login(FastLoginContext.java:218)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImpl.login(RemoteLoginContextHelperImpl.java:78)
at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImplp4_Skel.dispatch(RemoteLoginContextHelperImplp4_Skel.java:64)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
Caused by: com.sap.engine.services.security.exceptions.BaseLoginException: Authentication did not succeed.
at com.sap.engine.services.security.server.jaas.BasicPasswordLoginModule.login(BasicPasswordLoginModule.java:149)
at com.sap.engine.services.security.login.LoginModuleLoggingWrapperImpl.login(LoginModuleLoggingWrapperImpl.java:220)
at com.sap.engine.services.security.login.ModulesProcessAction.run(ModulesProcessAction.java:70)
... 13 moreHi Rajeev,
Thanks for your inputs. I myself am a basis guy. I ve already checked all the authorizations given to the user - PISUPER, and have found it to be fine. Can't understand why this security issue crops up still. anyways, i m getting this error when trying to import an object from the server. If i try to create a new object and during the process, try to import the SCV from SLD, i m facing with an error again, of a different sort. The log says...
====================================================================
= Root Exception ===================================================
====================================================================
Thrown:
com.sap.aii.utilxi.misc.api.BaseRuntimeException: Internal error during bean lookup for bean SldAccessServiceBean
at com.sap.aii.ib.clsif.gen.BeanAccessHandler.handleRuntimeExInBusinessMethod(BeanAccessHandler.java:113)
at com.sap.aii.ib.client.sldAccess.impl.SldAccessServiceDelegate.getSwcvLinks(SldAccessServiceDelegate.java:55)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel.getSwcvLinksAdapter(WorkspaceCreatePanel.java:520)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel.access$000(WorkspaceCreatePanel.java:75)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel$4.getResult(WorkspaceCreatePanel.java:449)
at com.sap.aii.utilxi.swing.toolkit.InterruptableProgressDialog$1.construct(InterruptableProgressDialog.java:190)
at com.sap.aii.utilxi.swing.toolkit.SwingWorker$2.run(SwingWorker.java:126)
at java.lang.Thread.run(Unknown Source)
Caused by: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Internal error during bean lookup for bean SldAccessServiceBean
at com.sap.aii.ib.clsif.login.LoginServiceImpl.getHomeInterface(LoginServiceImpl.java:460)
at com.sap.aii.ib.clsif.login.LoginServiceImpl.getBusinessInterface(LoginServiceImpl.java:425)
at com.sap.aii.ib.clsif.gen.BeanAccessHandler.getBean(BeanAccessHandler.java:60)
at com.sap.aii.ib.client.sldAccess.impl.SldAccessServiceDelegate.getBean(SldAccessServiceDelegate.java:79)
at com.sap.aii.ib.client.sldAccess.impl.SldAccessServiceDelegate.getSwcvLinks(SldAccessServiceDelegate.java:49)
... 6 more
Caused by: com.sap.aii.ib.core.ejbutil.HomeFactoryException: Exception during lookup operation of object with name sap.com/com.sap.xi.repository/SldAccessServiceBean, cannot resolve object reference.
at com.sap.aii.ib.clsif.login.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:381)
at com.sap.aii.ib.clsif.login.LoginServiceImpl.getHomeInterface(LoginServiceImpl.java:456)
... 10 more
Caused by: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name sap.com/com.sap.xi.repository/SldAccessServiceBean, cannot resolve object reference.
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:528)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:637)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.sap.aii.ib.clsif.login.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:353)
... 11 more
Caused by: javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name:
Type: clientAppName
Content: sap.com/com.sap.xi.repository
Type: interfaceType
Content: remote
Type: home
Content: com.sap.aii.ib.sbeans.sldAccess.SldAccessServiceHome
Type: ejb-link
Content: SldAccessServiceBean
Type: remote
Content: com.sap.aii.ib.sbeans.sldAccess.SldAccessServiceRemote
com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext.
at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:488)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:73)
at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:58)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:521)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:637)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.sap.aii.ib.clsif.login.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:353)
at com.sap.aii.ib.clsif.login.LoginServiceImpl.getHomeInterface(LoginServiceImpl.java:456)
at com.sap.aii.ib.clsif.login.LoginServiceImpl.getBusinessInterface(LoginServiceImpl.java:425)
at com.sap.aii.ib.clsif.gen.BeanAccessHandler.getBean(BeanAccessHandler.java:60)
at com.sap.aii.ib.client.sldAccess.impl.SldAccessServiceDelegate.getBean(SldAccessServiceDelegate.java:79)
at com.sap.aii.ib.client.sldAccess.impl.SldAccessServiceDelegate.getSwcvLinks(SldAccessServiceDelegate.java:49)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel.getSwcvLinksAdapter(WorkspaceCreatePanel.java:520)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel.access$000(WorkspaceCreatePanel.java:75)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel$4.getResult(WorkspaceCreatePanel.java:449)
at com.sap.aii.utilxi.swing.toolkit.InterruptableProgressDialog$1.construct(InterruptableProgressDialog.java:190)
at com.sap.aii.utilxi.swing.toolkit.SwingWorker$2.run(SwingWorker.java:126)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Can't get Socket. Reason:Connection timed out: connect
at com.sap.engine.interfaces.cross.io.transport.PortManager.getRealSocket(PortManager.java:284)
at com.sap.engine.interfaces.cross.LoadBalancerImpl.getAllAccessPoints(LoadBalancerImpl.java:97)
at com.sap.engine.interfaces.cross.CrossObjectBroker.getDestination(CrossObjectBroker.java:142)
at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:347)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:73)
at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:58)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:521)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:637)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.sap.aii.ib.clsif.login.EJBHomeFactory.lookUpHome(EJBHomeFactory.java:353)
at com.sap.aii.ib.clsif.login.LoginServiceImpl.getHomeInterface(LoginServiceImpl.java:456)
at com.sap.aii.ib.clsif.login.LoginServiceImpl.getBusinessInterface(LoginServiceImpl.java:425)
at com.sap.aii.ib.clsif.gen.BeanAccessHandler.getBean(BeanAccessHandler.java:60)
at com.sap.aii.ib.client.sldAccess.impl.SldAccessServiceDelegate.getBean(SldAccessServiceDelegate.java:79)
at com.sap.aii.ib.client.sldAccess.impl.SldAccessServiceDelegate.getSwcvLinks(SldAccessServiceDelegate.java:49)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel.getSwcvLinksAdapter(WorkspaceCreatePanel.java:520)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel.access$000(WorkspaceCreatePanel.java:75)
at com.sap.aii.ibrep.gui.workspace.WorkspaceCreatePanel$4.getResult(WorkspaceCreatePanel.java:449)
at com.sap.aii.utilxi.swing.toolkit.InterruptableProgressDialog$1.construct(InterruptableProgressDialog.java:190)
at com.sap.aii.utilxi.swing.toolkit.SwingWorker$2.run(SwingWorker.java:126)
at java.lang.Thread.run(Unknown Source)
at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:140)
at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:58)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:521)
... 14 more
Any clues what might be the issue?
thanks in advance,
Regards,
Basker -
How to cast an Object into a specific type (Integer/String) at runtime
Problem:
How to cast an Object into a specific type (Integer/String) at runtime, where type is not known at compile time.
Example:
public class TestCode {
public static Object func1()
Integer i = new Integer(10); //or String str = new String("abc");
Object temp= i; //or Object temp= str;
return temp;
public static void func2(Integer param1)
//Performing some stuff
public static void main(String args[])
Object obj = func1();
//cast obj into Integer at run time
func2(Integer);
Description:
In example, func1() will be called first which will return an object. Returned object refer to an Integer object or an String object. Now at run time, I want to cast this object to the class its referring to (Integer or String).
For e.g., if returned object is referring to Integer then cast that object into Integer and call func2() by passing Integer object.GDS123 wrote:
Problem:
How to cast an Object into a specific type (Integer/String) at runtime, where type is not known at compile time.
There is only one way to have an object of an unknown type at compile time. That is to create the object's class at runtime using a classloader. Typically a URLClassloader.
Look into
Class.ForName(String) -
I need to add the values stored in the session object into the html textbox
Dear Sir,
i have been trying to create an edit employee details page
What i have done till now is as follow:
1. Got employee id from HTML page.
2. Compared it with the id stored in the database.
3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.
4. Dispatched the session values to another servlet EditEmpDetails2.java
what i need to do now
5. Now i need to set the session values in the text field of the html form
6. I also need to be able to edit those vales and store the edited values in the database.
Please help me as i have tried doing it for 1 week without any clues
i have tried to create a html page which is something like this:
<html>
<head>
<title>Edit Employee Details Page</title>
<body BGCOLOR="red" text="black">
<h1 ><font color="black">Edit Employee Details Page</font></h1>
<form action = "EditEmpDetails" method="Get">
<table width="50% align="center"
<tr><td>Employee ID: </td>
<td><INPUT TYPE="TEXT" name="employeeid"<br></td></tr>
<tr><td><center><input type="submit" value="submit"></center></td></tr>
<tr><td><center><input type="reset" value="reset" ></center></td></tr>
</table>
</form>
</body>
</html>
design of my servlet EditEmpDetails.java
public void EditEmpDetails1 extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
PrintWriter out = response.getWriter();
response.setContentType("text/html");
HttpSession session = request.getSession();
String employeeid;
String X = request.getParameter("employeeid");
System.out.println("Employee iD:" + X);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:murphy");
String query = "Select * from users where employeeid=?";
PreparedStatement stat = con.prepareStatement(query);
System.out.println(stat);
stat.setString(1,X);
ResultSet rs = stat.executeQuery();
while(rs.next())
String Z = rs.getString(password);
if(Z.equals(X))
String A = rs.getString(1);
session.setAttribute("employeeid", A);
String B = rs.getString(2);
session.setAttribute("firstname", B);
String C = rs.getString(3);
session.setAttribute("lastname", C);
String D = rs.getString(4);
session.setAttribute("gender", D);
String E = rs.getString(5);
session.setAttribute("dateofbirth", E);
String F = rs.getString(6);
session.setAttribute("address", F);
String G = rs.getString(7);
session.setAttribute("postalcode", G);
String H = rs.getString(8);
session.setAttribute("phone", H);
String I = rs.getString(9);
session.setAttribute("mobile", I);
String J = rs.getString(10);
String url = "/EditEmpDetao;s.java";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url)
dispatcher.forward(request,response);
catch (Exception e)
system.out.println(e)
I do not know how to put the values stored in the session object into the html text box3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.do you really need to store this in session object?
5. Now i need to set the session values in the text field of the html form which form? in a new html/jsp page? i suggest go for a JSP
In your JSP page use JSP expression tags to put the session attributes.
it's something like : <input type='text' name='employeeid' value='<%= session.getAttribute("employeeid") %>' >and you need to generateanother servlet for saving the details/modifications to the database.
I think i m clear enough.
if you need more clarifications. just try it and then post your problem.
Diablo -
How to pass a locale object into another function?
Greetings,
i like to pass a locale object into another function. These are my code below
import java.util.*;
public class Locales{
public static void main(String[] args){
Locale locale= new Locale("EN", "US");
convert(locale);
public void convert(Locale convert)
String language = convert.getDisplayLanguage();
System.out.println(language);
}I got this error:
Locales.java:6: non-static method convert(java.util.Locale) cannot be referenced from a static content
convert(locale);
^How do i correct it?
ThanksDid you bother to do a search?
Did you bother to read any of the material that the search would have linked you to?
If you had then you would be able to understand where you are going wrong and how to fix it yourself. Instead of being spoonfed by us. -
Cannot open PDFs inserted as objects into Excel.
Two-part question. I know this has been addressed before, but the solutions are not working for me.
I have Adobe Acrobat 9 Pro and Adobe Reader XI. When inserting a PDF document as an object into Excel, it will not allow me to insert the icon/object from the "Create New" option. I get one of two error messages: 'Cannot insert object' or 'Cannot start the soruce application for this object'. I am able to insert the PDF icon/object if I insert from the "Create from file" option. (Please note I cannot always link to the PDF, as some spreadsheets are sent out externally and will not have access.)
Once I am finally able to insert the document as an object, I can open and view the PDF. However, when I close the spreadsheet and re-open it, if I try to open the PDF document again, I get this error message again: 'Cannot start the soruce application for this object'.
I have changed my preference to disable the Protected Mode at startup and this issue is still happening. VERY frustrating. I never encountered this is past versions of Adobe and all previous suggestions are not fixing the issue. Does anyone have any insight or know of an update to fix this issue? Is this an Adobe issue or a Microsoft Office issue?Hi Jerry,
Can you check the similar thread
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d554e88c-d72f-46b0-8b1a-2f2024fcb9c0/i-e-8-browser-wont-open-pdf-file-returned-from-sharepoint-2010-search?forum=sharepointadminprevious
My Blog- http://www.sharepoint-journey.com|
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful -
Converting Array Objects into ArrayCollections
Hi,
I am facing problem with converting Array Objects into ArrayCollections. How can i convert Array Objects into ArrayCollections. If any one knows how can we do that Pl reply.
Thanks in advance to all
Regards
subbareddy.pHi Bhasker,
thanks for u r reply. Here i attached screen shot of my server "data.result".
My proxy varaible contains
My object varaible "obj" contains
After parsing the result my arraycollection contains, (i mean after converting Object to Array to ArrayCollection) the below information. For information Pl find the attached arraycollection.png image. In the attached image my arraycollection name is "users".
Here i pasted the code that i used to convert "ObjectProxy" to "ArrayCollection"
var proxy:ObjectProxy = ObjectProxy(data.result);
var obj:Object = proxy.object_proxy::object;
var arrycoll:Array = ArrayUtil.toArray(obj);
model.users = new ArrayCollection(arrycoll);
Regards
sss -
Adding objects into query Panel and no display report
Hi Folks,
I had an issue with WEBI .
Iam running the report with few objects at first time , all objects are displayed in the table format of report.
I saved and closed the report .
Later i opened the report and edited the report by adding new objects into query panel and runing it.
but this time i did not find the new objects in display table in report as like DeskI.
If we find the solution for this , it will be great help to me.
Thanks
MaheshThe objects will be in the data tab. Objects are not automatically added to your report in Webi, they are made available in the data panel, and you can choose which objects to add.
Maybe you are looking for
-
Populating the data from table onto drop-down list.
Hi all The following code i have used in trigger 'when-new-form-instance' DECLARE group_id RecordGroup; list_id Item := Find_Item('Lines.classification'); status NUMBER; rg_name varchar2(10) := 'rgroup'; BEGIN clear_list(list_id); group_id := Find_Gr
-
Trying to restore Time Machine back-up from WD MyBookLive - whats the Password?!
Hi all, my son has a Macbook Pro running Lion. Yesterday it hung when downloading the 10.7.3 update and wouldn't reboot properly. We logged in via safe mode and managed to sort this out, however I was initially looking at doing a restore from his tim
-
Do I have to buy windows media player to watch wmv files on my imac?
please advise
-
I was unable to make a simple pdf from word doceumen. I reinstalled AA8 and updated on my win 7 x64 machine. I continue to have same problem. Coversion to pdf form word 2007 or word 2003 document quits at 10% complete only saying an error occured.
-
?? about popup window using javascript
I am launching a popup window using the following script. locate.onRelease = function(){ getURL("javascript:n_name=window.open(' http://www.wesitename.com/webpage.cfm','name_name1','width=720,height=330,scrollbars=yes') ;void(0);"); Right now all of