When restoring tables with export/import, it is common to disable any constraints, drop any non-primary key index, and disable any trigger. After the import simply enable constraints, enable triggers, and rebuild any index.
A quick way to get the index DDL is by using the export dump file. Run the dump file through import with the "indexfile" option.
imp file=export.dmp indexfile=index.sql fromuser=theSchemaOwner
File "index.sql" will be created. The tables will be in the file and commented out.
I learned this from Tom's web site.
Sunday, May 21, 2006
Tuesday, May 16, 2006
Quickly Generate Oracle Object Grants
This quickly generates an Oracle SQL script that can be called to grant privileges to a user or role. Extend for other object types.
select 'grant execute on ' || object_name || ' to &&userOrRole;' || ' -- ' || object_type
from dba_objects where owner='&&OWNER' and object_type in ('PACKAGE', 'PROCEDURE')
union all
select 'grant select, insert, update, delete on ' || object_name || ' to &&userOrRole;' || ' -- ' ||
object_type
from dba_objects where owner='&&OWNER' and object_type in ('TABLE', 'VIEW')
/
select 'grant execute on ' || object_name || ' to &&userOrRole;' || ' -- ' || object_type
from dba_objects where owner='&&OWNER' and object_type in ('PACKAGE', 'PROCEDURE')
union all
select 'grant select, insert, update, delete on ' || object_name || ' to &&userOrRole;' || ' -- ' ||
object_type
from dba_objects where owner='&&OWNER' and object_type in ('TABLE', 'VIEW')
/
Sunday, May 14, 2006
Unix Remote Login Without Password
This has been covered in many places, so this will be a short version. This is not using the insecure r?? commands with .rhosts.
Assume both machines have the same or similar ssh installation.
"hosthere" is where you are logged on. "hostfar" is where you want to log on.
Use an empty passphrase and default key location.
hosthere $ ssh-keygen -t dsa
Place "pub" file on hostfar in ~/.ssh as "authorized_keys2".
hosthere $ scp id_dsa.pub hostfar:.ssh/authorized_keys2
Now ssh and scp to "hostfar" should not prompt for a password.
Troubleshooting includes checking permissions of .ssh directory and files.
Assume both machines have the same or similar ssh installation.
"hosthere" is where you are logged on. "hostfar" is where you want to log on.
Use an empty passphrase and default key location.
hosthere $ ssh-keygen -t dsa
Place "pub" file on hostfar in ~/.ssh as "authorized_keys2".
hosthere $ scp id_dsa.pub hostfar:.ssh/authorized_keys2
Now ssh and scp to "hostfar" should not prompt for a password.
Troubleshooting includes checking permissions of .ssh directory and files.
Subscribe to:
Posts (Atom)