sâmbătă, 24 august 2013

Infamous "The installer is unable to instantiate the file C:\Users\oracle\AppData\Local\Temp\{CF7ACE29-F720-4702-8739-0DEB3758625D}\KEY_XE.reg" error, during Oracle XE installation

It happens, when install de XE on Windows 7 64 bit, to receive this error from the title. Don't panic, has nothing to do with user rights or folder permissions. It's just another bug.
When error appears, just avoid to click on it, go to folder C:\Users\oracle\AppData\Local\Temp\{CF7ACE29-F720-4702-8739-0DEB3758625D}\, of course, accordingly with your path, copy  the file OracleMTSRecoveryService.reg to KEY_XE.reg, then return to the installing program, click the error and go further. Nothing will bother you again.

miercuri, 21 august 2013

How to grant select any table or view to another user

user1 is the current user.
user2 is the grantee.


sqlplus

conn user1/....


declare
nume varchar2(50);
begin
FOR nume IN (SELECT * FROM user_views )
LOOP
  EXECUTE IMMEDIATE 'GRANT SELECT ON ' || nume || ' TO user2';
END LOOP;
FOR nume IN (SELECT * FROM user_tables )
LOOP
  EXECUTE IMMEDIATE 'GRANT SELECT ON ' || nume || ' TO user2';
END LOOP;
end;

That's it!