Tuesday, October 28, 2014

how to import database into oracle?




Import schemas(table,view,trigger,cursor etc.) into Oracle:

There are two ways to import shcemas.
 1. Using Directory
 2. Without using Directory

1. Using Directory:-

Step i.
  Create a folder at first in any drive.

Step ii. 
  Open SQL prompt and create a directory using given syntax:
   SQL> create directory directory-name as folder-name
 where directory-name is any name and folder-name must be what you've created in step 1.

Step iii. 
 Exit from sql prompt and write import command at command prompt using given synatx:
 C:\> impdp User/password dumpfile=file-name.dmp directory=directory-name remap_schema=Old User:New User
 where User is user-name with import privilege, password is the password for that user,  file name is exported dump file name with extension .dmp, directory-name is the same name what you created in step ii. and for remap_schema, old user is the user for which  you exported already the schema(table, view, function etc.)  and NewUser the user for which u want to import database.

Friday, October 24, 2014

how to export database in oracle?




Export schemas(table,view,trigger,cursor etc.) from Oracle:

There are two ways to export shcemas.
 1. Using Directory
 2. Without using Directory

1. Using Directory:-
Step i.
  Create a folder at first in any drive.

Step ii. 
  Open SQL prompt and create a directory using given syntax:
   SQL> create directory directory-name as folder-name
 where directory-name is any name and folder-name must be what you've created in step 1.

Step iii. 
 Exit from sql prompt and write export command at command prompt using given synatx:
 c:\> expdp User/password dumpfile=file-name.dmp directory=directory-name schemas=User
 where User is user-name with export priviledge, password is the password for that user, dump file name is any file name with extension .dmp, directory-name is the same name what you created in step ii. and schemas user is for which you want to export schemas(tables, views, function etc.)  

 Example:-

Here is the exported dump file:







2. Without using Directory:

 Remove (directory=directory-name) attribute from step iii above. So, syntax would be like this:
 Syntax:
  C:\>expdp user/password dumpfile=dump-file-name schemas=User
This time the dump file location would be default location of oracle. I'm using 10g express edition so my default file location is 'c:\oraclexe\app\oracle\admin\xe\dpdump\dump-file.dmp'. Default location may vary according to version. On command prompt see the 2nd line from last. This is your default dump-file location.

Example:

Friday, October 17, 2014

how to create dynamic table?



Sometimes ago, when i was developing a Web Application then i'd need to create dynamic table. I did google but nothing found useful for me. Then i decided to develop it by myself. Although it took some great time but yes, the outcome was fabulous.
Here is the code.
 Dyntable.js
function getVal()
{
var val=document.frm.txt1.value
var str="<table border='2'><tr> 
<th nowrap='nowrap'><font color='blue' size='2'>Item 1</font></th>
<th><font color='blue' size='2'>Item 2</font></th>
<th><font color='blue' size='2'>Item 3</font></th> 
</tr>" 
//validation logic for each table's cell 
var b=0;
while(val>0)
{
str=str+"<tr><td>
<input type='text' name='jtext"+ ++b 
+"' onBlur='if(isNaN(this.value)){ 
alert(\"value must be numeric !!!\") 
} 
else if(this.value<=0) 
{ alert(\"Value must be greater than zero !!!\") 
} '/></td><td><input type='text' name='jtext"+ ++b 
+"' onBlur='if(isNaN(this.value)){ 
alert(\"value must be numeric !!!\") } 
else if(this.value<=0) { 
alert(\"Value must be greater than zero !!!\") 
} '/></td><td>
<input type='text' name='jtext"+ ++b +"' 
onBlur='if(isNaN(this.value)){ 
alert(\"value must be numeric !!!\") } 
else if(this.value<=0) { 
alert(\"Value must be greater than zero !!!\") } '/>
</td></tr>";
val--;
} 
str=str+"</table>"; 

document.getElementById("spn").innerHTML=str;
} 

Htmlcode.html

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dynamic table</title>
</head>
<script language="javascript" src="Dyntable.js"> </script>
<body>
<center>
<h1>Dynamic table</h1>
<form name="frm">
<input type="text" size="20" name="txt1">
</br></br>
<input type="button" value="ok" name="okbtn" onclick='getVal()'>
</form>
<p>
<span id="spn"></span>
</center>

</body>
</html>



Here is Output: