Thursday, 29 November 2018

Uninstall Oracle Database in Window 10

To uninstall Oracle, follow these steps:

1. Go to Services and make sure that all Oracle services are stopped.
2. Go to Start->Run and type 'regedit' to invoke the registry editor.
3. Navigate to HKEY_LOCAL_MACHINE Software.
4.     Take Backup of Software Folder by right click on Software and select Export.
5.     Select Oracle folder and delete it.
6.     Again Navigate to HKEY_LOCAL_MACHINE.
7.     Open SYSTEN folder.
8.     Open CurrentControlSet.
9.     Open Services
10.   Search Oracle services and delete them.
11. Right click on My Computer and select Properties. Click to access the Environment Variables.            Find the PATH environment variable and edit it to remove any occurences of Oracle directories.
12. Using Explorer, remove any remaining Oracle directories, notably the ORACLE_HOME and

C:Program FilesOracle. If there are files you cannot remove, reboot your machine and retry the delete operation.

Remove Items in All apps in Windows 10 Start menuOption One
To Add or Remove Items in All apps for Only Your Account
Copy and paste the folder location below into the address bar of File Explorer, and press Enter to open the folder.

 %AppData%\Microsoft\Windows\Start Menu\Programs

OPTION TWO
To Add or Remove Items in All apps for New Accounts Added to PC
You must be signed in as an administrator to be able to do this option.

When you add a new account to your PC, its All apps will be created to have the items in this option and Option Three below listed in it.

1. Copy and paste the folder location below into the address bar of File Explorer, and press Enter to open the folder.

 C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
OPTION THREE
To Add or Remove Items in All apps for All Accounts on PC
You must be signed in as an administrator to be able to do this option.

1. Copy and paste the folder location below into the address bar of File Explorer, and press Enter to open the folder.

 %ProgramData%\Microsoft\Windows\Start Menu\Programs


You should now have a clean machine that you can reinstall Oracle on. Here is the link

Wednesday, 28 November 2018

Install or deinstall Oracle Developer 6i in window 10

PRE-INSTALLATION STEPS

Link
Step1: https://www.youtube.com/watch?v=c8iVItLhQgY

Step2: Open the Dev_setup folder\ win32 \ ssf \ 6_0_0_0_0 \ install \ SSF60.INS file with a text editor (example: Notepad ++). Delete lines 219 to 231 in the following sections:


Step3: copy(dll_rest);
/******************
 Her is the link

Saturday, 10 November 2018

Oracle "with admin" vs. "with grant" security privileges

Question:  What is the difference between the "with admin" option and the "with grant" option.  How do these grant option affect user access?

Answer:  There is a very distinct difference, and it's important to carefully consider the ramifications of using either "with grant option" or "with admin option".  These option relinquish control of the database privileges from a single database owner to multiple users, something that must be carefully controlled to ensure proper security.

Beware:  Using "with admin" and "with grant" options are considered Oracle dangerous because if they are not managed carefully you can have unintended side effects, resulting to a security hole.

Both the 'with grant' and 'with admin' options serve to relinquish central security control, but they are for different types of privileges.

With Grant option:
  • Only for object privileges, not system privileges.
  • Only the person who granted the privilege can revoke the privilege.
  • Revoked privileges can "cascade", allowing the first grantor to revoke many subsequent grants.

With Admin option:
  • Only for system privileges, not object privileges.

Using the with admin option


Any 'global' privileges like roles and system privileges (e.g. CREATE TABLE) are granted using the WITH ADMIN OPTION. For table-specific privileges (e.g. GRANT select on emp) we use WITH GRANT OPTION syntax. Also, revoking any grant WITH GRANT will cascade and revoke any and all privileges assigned by the privileged user. On the other hand, revoking someone with the WITH ADMIN OPTION will only revoke their personal privileges, leaving intact all granted users.

When system privileges are passed to others using the WITH ADMIN OPTION, revoking the system privileges from the original user will not cascade. The system privileges granted to others must be revoked directly. In contrast, when object privileges are passed on to others using the WITH GRANT OPTION, the object privileges are revoked when the grantor's privileges are revoked.

It is important to note that only object privileges will cascade when revoked; system privileges will not.

When the WITH ADMIN OPTION or WITH GRANT OPTION has been included in a grant to another user, the privilege cannot be revoked directly. You must revoke the privilege and then issue another grant without the WITH ADMIN OPTION or WITH GRANT OPTION.
 

The "with admin" privilege


Sometime you want to grant privileges to users and have them be able to grant those privileges to other users. When this is the case, we include the WITH ADMIN OPTION keyword in the GRANT command. When this keyword is used, it will allow the user granted the privilege to grant that privilege to other users.
 
Privileges that are granted WITH ADMIN OPTION can be passed to other users. Hence, many companies prohibit this option, and others check to ensure that all user ID's are proper.  Here is an example of the usage of the with admin option keyword.

GRANT
   CREATE INDEX
TO
   Robert
WITH ADMIN OPTION;

The metadata security audit information for users having the WITH ADMIN OPTION is located in the DBA_SYS_PRIVS view. Read more here.

 

The "with grant" privilege
 

The WITH GRANT option allows you to give the user you are assigning the privilege to grant this privilege to other users.  Only the schema that owns the object can grant privileges to that object unless the WITH GRANT option is included in the command.  Here is an example of the use of the with grant option:
GRANT SELECT ON
   emp
TO
   scott
WITH GRANT OPTION;

Here is the link

Sunday, 28 January 2018

RMAN Backup

RMAN Backup

[oracle@ora1 ~]$ sqlplus / as sysdba

SQL> archive log list;

SQL> show parameter recovery_file_dest;

SQL> alter system set db_recovery_file_dest_size=75g scope=both;

SQL> archive log list;

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database archivelog;

SQL> alter database open;

SQL> archive log list;

SQL> exit;

[oracle@ora1 ~]$RMAN target /;

RMAN> backup database plus archivelog;

Here is the link

Auto Backup of Dump File

LINUX

Write shell script - create file expdp.sh in oracle user and place it in /Home/oracle/scripts/expdp.sh


[oracle@localhost ~]$ cd /home/oracle/scripts/

[oracle@localhost scripts]$ vi expdp.sh

and
copy following lines
------------------------------------------------
#!/bin/ksh

#Script to perform datapump export every hour

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

export ORACLE_SID=fort

export PATH=$PATH:$ORACLE_HOME/bin

expdp has/fcserver@fort directory=export_dp dumpfile=fort-$(date +%d%m%Y_%H%M%S).dmp logfile=fort-$(date +%d%m%Y_%H%M%S).log schemas=has
---------------------------------------------------

#mv /tmp/fort*.dmp /u01/dumps/

#mv /tmp/fort*.log /u01/dumps/

#chmod o+r /u01/dumps/*

# chmod u+x /home/oracle/scripts/expdp.sh
# chown oracle.oinstall /home/oracle/scripts/expdp.sh


[oracle@localhost ~]$ crontab -e

and add following lines


# daily logical export

01 23 * * * /home/oracle/scripts/expdp.sh


save and quite

Windows

Create batch file exp.bat with following lines.

exp oadm/nopassword@injsys file=c:\accounts\backup\----------------------------------


start > run > task

add task scheduler > ----------------------------------

How to take Data Pump Backup from a remote database

Oracle Data Pump is a new and unique feature of Oracle Database 11g Release 2. A new public interface package, DBMS_DATAPUMP, provides a server-side infrastructure for fast data and metadata movement between Oracle databases. It is ideal for large databases and data warehousing environments, where high-performance data movement offers significant time savings to database administrators.

 

Data Pump automatically manages multiple, parallel streams of unload and load for maximum throughput. The degree of parallelism can be adjusted on-the-fly. There are new and easy-to-use Export and Import utilities (expdp and impdp), as well as a web-based Enterprise Manager export/import interface.

 

Data Pump Export and Import both support a network mode in which the job’s source is a remote Oracle instance. When you perform an import over the network, there are no dump files involved because the source is another database, not a dump file set.

 

When you perform an export over the network, the source can be a read-only database on another system. Dump files are written out on the local system just as they are with a local (non-networked) export.

 

 

 

In the following example, I am showing you step by step procedure to export(expdp) from a remote database:

 

 

 

Here in this example, source database is  Oracle 11g and  running on linux and there is another computer running on windows where you need to take backup of source database. At first install oracle 11g on windows machine. After installation of oracle, add source database’s network information to tnsnames.ora file as follows:

 

SOURCE =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.20)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ORCL)

)

)

 

Then create a folder where backup will be taken. For example D:\BACKUP

 

 

 

2. You have to create a user on source database(running on linux) to take export backup. You also have to grant appropriate permission to new user for taking backup as follows:

 

[oracle@testserver ~]$ sqlplus

 

SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 22 10:12:51 2016

 

Copyright (c) 1982, 2009, Oracle. All rights reserved.

 

Enter user-name: sys as sysdba

Enter password:

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> create user dpback identified by dpback;

 

SQL> grant connect, resource to dpback;

 

SQL> grant EXP_FULL_DATABASE to dpback;

 

SQL> GRANT CREATE ANY DIRECTORY TO dpback;

 

 

 

3. Login to your database(running on windows) as follows:                                                                                                                                                C:\Users\SUMAN>sqlplus

 

Enter user-name: sys as sysdba

Enter password:

 

Create a dblink to source database as follows:

 

SQL> CREATE PUBLIC DATABASE LINK SOURCE

CONNECT TO dpback

IDENTIFIED BY dpback

USING ‘SOURCE’;

 

You need to create a user to take expdp backup just like you did at your source database

 

SQL> create user dpback identified by dpback;

 

SQL> grant connect, resource to dpback;

 

SQL> grant EXP_FULL_DATABASE to dpback;

 

SQL> GRANT CREATE ANY DIRECTORY TO dpback;

 

 

 

4. Connect as dpback user

 

SQL> conn dpback

Enter password:

Connected.

SQL> create directory dp_dir as ‘D:\BACKUP’;

 

Directory created.

 

5. Now you can take expdp backup by running following command

 

C:\Users\SUMAN>expdp dpback/dpback directory=dp_dir full=Y dumpfile=full.dmp logfile=full.log network_link=SOURCE

 

Here network_link=SOURCE is important. SOURCE is the dblink name that I create at first.

 

You can add compression, parallel etc parameter for better performance. You can also create a batch file to automate backup as follows:

 

expdp dpback/dpback directory=dp_dir full=Y dumpfile=full_epayment%date:~-4%_%date:~4,2%_%date:~7,2%_%time:~0,2%_%time:~3,2%.dmp logfile=full_epayment%date:~-4%_%date:~4,2%_%date:~7,2%_%time:~0,2%_%time:~3,2%.log compression=all network_link=SOURCE

 

 

 

To import you can use following command:

 

impdp system/**** directory=dp_dir full=Y dumpfile=FULL_EPAYMENT.DMP logfile=imp_full_epayment.log EXCLUDE=SCHEMA:\”LIKE \’SYS%\’\”

 

Before executing impdp command, make sure that

 

1) IMP_FULL_DATABASE is granted to the import user

 

2) All the tablespaces of source database has been created. Here is the link

https://sumanruet.wordpress.com/2016/08/21/how-to-take-data-pump-backup-from-a-remote-database/

Data Pump or Export/ Import Data from Oracle 11g in Linux OS

First of all you must create a file location for the dump files.

Log in as Oracle user and create a file wherever you want. My file name is "dumps"

[oracle@prod ~]$ mkdir /u01/dumps

[oracle@prod ~]$ ls /u01/

app database dumps

[oracle@prod ~]$
---------------------------------------------------------------------------------
So first of all you must log into the database as the schema user.

[oracle@prod ~]$ sqlplus has/fcserver

Then issue below command to create the directory

SQL> create or replace directory export_dp as '/u01/dumps/';

Directory created.

export_dp is the logical name that you can give for your directory and the '/u01/dumps/' is the physical path.

You can check yous directory using below command

SQL> select directory_name from all_directories;

DIRECTORY_NAME
------------------------------
EXPORT_DP

[oracle@localhost ~]$ su - root

Password:

[root@localhost ~]# chmod 777 /u01/dumps

[root@localhost ~]# chmod 755 /u01/dumps 

[root@localhost ~]# chmod 777 /u01/dumps/greens-26012018_230101.dmp


[root@localhost ~]# su - oracle

SQL>
-----------------------------------------------------------------------------
now exit from sql promt and come back to oracle promt and issue below statement to take the export.

[oracle@prod ~]$ expdp has/fcserver@fort directory=export_dp dumpfile=has-$(date +%d%m%Y_%H%M%S).dmp logfile=has-$(date +%d%m%Y_%H%M%S).log schemas=has

OR

[oracle@prod ~]$ expdp hr/hr@DB11G directory=export_dp dumpfile=dump_hr.dmp logfile=log_hr.log schemas=hr
------------------------------------------------------------------------------
As you can see tables have been exported.. Cross verify whether dump file is there in the location.

[oracle@prod ~]$ ls /u01/dumps/

dump_has.dmp log_has.log
-------------------------------------------------
Now login to database as SYS user and create the new schema.. First of all you must create the tablespace for the user and then create the user. My tablespace name is "has_tablespace" and the user is "has".

[oracle@prod ~]$ sqlplus / as sysdba

SQL> create tablespace has_tablespace datafile 'has.dat' size 20M autoextend on;

Tablespace created.
-----------------------------------------------------------------------------------------------------------------------
Dropping a Tablespace:

Example The following statement drops the has_tablespace tablespace and drops all referential integrity constraints that refer to primary and unique keys inside has_tablespace:

DROP TABLESPACE has_tablespace 
    INCLUDING CONTENTS 
        CASCADE CONSTRAINTS; 

Deleting Operating System Files:

Example The following example drops the has_tablespace tablespace and deletes all associated operating system datafiles:

DROP TABLESPACE has_tablespace
   INCLUDING CONTENTS AND DATAFILES;
----------------------------------------------------------------------------------------------------------------------
If you want to create user has and assign has_tablespace tablespace for the user

SQL> create user has identified by fcserver default tablespace has_tablespace temporary tablespace temp quota unlimited on has_tablespace;

User created.

Now grant whatever the access you need for the user...I give dba writes for the user.

SQL> grant dba to has;

Grant succeeded.

SQL>

OR
--------------------------------------------------------------------------------------------------------------------
Now Log in as user and create import directory

SQL> connect has/fcserver

Connected.

SQL> create or replace directory import_dp as '/u01/dumps/';

Directory created.

now exit from sql and come to oracle prompt and issue below.

[oracle@prod ~]$ impdp has/fcserver@fort directory=import_dp dumpfile=greens-26012018_230101.dmp logfile=log_has.log REMAP_SCHEMA=sys:has


ora-39006: Internal Error

ora-39213: Metadata processing is not available

[oracle@prod ~]$ sqlplus / as sysdba

SQL> execute sys.dbms_metadata_util.load_stylesheets;

PL/SQL procedure successfully completed.
SQL>

Here is the link

--------------------------------------------------------------------------------------------------------------------------

Thursday, 23 November 2017

ADF 12c : CheckBox Demo (Select one checkbox in table, Select all/Deselect all)

If you are a regular user of ADF and the checkbox component you might have already saw the Bhasker's Blog demo ADF 11g of creating a checkbox in table. Here you'll see creating the same kind of demo application with checkbox as one of the table column in jdeveloper 12c. One more added feature you will see here is the Select all /Deselect all checkbox on the column header.



Components : JDev 12c production verion available at otn for free download.
Oracle XE Free database with a schema with EMP table.
Add the Sports_Intrested (Varchar2(1)) column to the EMP table which we will be using to show the check box in the ui.

Sports intrested column is a varchar2(1) column which stores the values 'Y' or 'N' depending
upon a Employee is intrested in sports or not.




Create a EmpEO ,EmpVO and a CheckBoxDemoAM using the EMP table.



leave the attributes to their default types.SportsIntrested Attribute will be a String Attribute.



Create a Test page and drop the Emp VO instance under the CheckBoxDemoAM on the test page to create a ADF faces table.



This would render the column SportsIntrested as a simple Output text column showing the Y or N values.



And the TestPG will only have single tree binding to the Emp1Iterator.



Now delete the sportsIntrested Output text from the SportsIntrested Column.(Leave the column intact , only delete the output text.We need the Column to create the checkbox.)



Right Click on column SportsIntrested attributes on the TestPG in the SportsIntrested Column, select insert inside column then select ADF Faces. 



selectOneBooleanCheckbox.



Go to Binding





The wizard will ask you for the values which should be mapped to the checkbox when it is checked or unchecked.give the value 'Y' for the selected value and the value 'N' for the unselected.Now do two things.





1.set the autosubmit value on the checkbox to true, unless you do this your checkbox value is not submitted.
2.give a value to the id property of the checkbox and set it as one of the partial trigger to the af table.





The newly created checkbox will create a button binding to map the checkbox check/uncheck condition depending upon the attribute value.



That's It your 12c checkbox demo is ready!!..