Saturday, July 26, 2008

Oracle User

create user alfredo identified by alfredos_secret;
create user alfredo identified externally;
create user alfredo identified globally as 'external_name';
create user alfredoidentified by alfredos_secretdefault tablespace ts_userstemporary tablespace ts_temp;
grant connect to alfredo;
ALTER USER username [ WITH PASSWORD 'password' ] [ CREATEDB NOCREATEDB ] [ CREATEUSER NOCREATEUSER ] [ VALID UNTIL 'abstime' ]

ALTER USER myuser IDENTIFIED BY new_password;
ALTER USER myuser
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp
QUOTA 100M ON users QUOTA 0 ON my_data;
ALTER USER myuser ACCOUNT LOCK;
ALTER USER myuser ACCOUNT UNLOCK;
ALTER USER myuser PASSWORD EXPIRE;
ALTER USER mark WITH PASSWORD 'ml0215em'
ALTER USER mark VALID UNTIL 'Dec 24 2012'
DROP USER myuser CASCADE;

Object privileges allow a user to perform a specified action on a specific object. Other users can access user-owned objects by preceding the object name with the user name (username.object). Object privileges extend down to table columns.
GRANT {object privilege [, ... ] ALL [PRIVILEGES] } ON [schema.] objectTO { { user role PUBLIC } [, ... ] } [WITH GRANT OPTION];

GRANT {object privilege [, ... ] ALL [PRIVILEGES] } [(column [, ... ])] ON [schema.] objectTO { { user role PUBLIC } [, ... ] }[WITH GRANT OPTION];

Only INSERT, UPDATE and REFERENCES privileges can be granted at the column level.
To create users in Oracle whose authentication is done by the operating system or by password files, the DBA will use:

Method 1:
Step 1. Set the initSID.ora parameters as:
remote_os_authent=TRUE os_authent_prefix = "OPS$"
Step 2. Generate a new spfile
CREATE spfile FROM pfile='initorabase.ora';
3. Add the following to the sqlnet.ora
sqlnet.authentication_services = (NTS)
Method 2:
Step 1: Connect as system/manager in SQL*Plus and create the Oracle user:
CREATE USER ops$oracle IDENTIFIED EXTERNALLY;
GRANT create session TO ops$oracle;
Step 2: Create a user in the operating system named oracle if one does not already exist.
Step 3: Go to command line (terminal window in UNIX, cmd in Windows. Type 'sqlplus' (without the single quotes).
Method 3:
Step 1: Connect as system/manager in SQL*Plus and create the Oracle user:
CREATE USER "PC100USER" IDENTIFIED EXTERNALLY;
where PC100 is the name of the client computer. Then
GRANT CREATE SESSION TO "PC100USER";
Step 2: Create a user in Windows named USER.
Step 3: Log on Windows as USER and go to the C: command line. Object privileges allow a user to perform a specified action on a specific object. Other users can access user-owned objects by preceding the object name with the user name (username.object). Object privileges extend down to table columns.
GRANT {object privilege [, ... ] ALL [PRIVILEGES] } ON [schema.] objectTO { { user role PUBLIC } [, ... ] } [WITH GRANT OPTION];
GRANT {object privilege [, ... ] ALL [PRIVILEGES] } [(column [, ... ])] ON [schema.] objectTO { { user role PUBLIC } [, ... ] }[WITH GRANT OPTION];
Only INSERT, UPDATE and REFERENCES privileges can be granted at the column level.
To create users in Oracle whose authentication is done by the operating system or by password files, the DBA will use:
Method 1:
Step 1. Set the initSID.ora parameters as:
remote_os_authent=TRUE os_authent_prefix = "OPS$"
Step 2. Generate a new spfile
CREATE spfile FROM pfile='initorabase.ora';
3. Add the following to the sqlnet.ora
sqlnet.authentication_services = (NTS)
Method 2:
Step 1: Connect as system/manager in SQL*Plus and create the Oracle user:
CREATE USER ops$oracle IDENTIFIED EXTERNALLY;
GRANT create session TO ops$oracle;
Step 2: Create a user in the operating system named oracle if one does not already exist.
Step 3: Go to command line (terminal window in UNIX, cmd in Windows. Type 'sqlplus' (without the single quotes).
Method 3:
Step 1: Connect as system/manager in SQL*Plus and create the Oracle user:
CREATE USER "PC100USER" IDENTIFIED EXTERNALLY;
where PC100 is the name of the client computer. Then
GRANT CREATE SESSION TO "PC100USER";
Step 2: Create a user in Windows named USER.
Step 3: Log on Windows as USER and go to the C: command line.

No comments:

user level export and import

expdp parfile=PLCT170.par oracle@uslp123sd7dfcvxsza > more PLCT050.par userid= "/ as sysdba" dumpfile=T050.dmp logfile=expdpT0...