Tuesday, November 6, 2012

Commonly used SqlPlus Commands


SOME IMPORTANT FREQUENTLY USED ORACLE SQLPLUS COMMANDS:

CREATE USER username IDENTIFIED BY password;
ALTER USER username IDENTIFIED BY newpassword;
DROP USER username [CASCADE]
To list all the usernames:
SELECT NAME FROM SYS.USER$
GRANT CONNECT, RESOURCE TO myuser;

REVOKE UNLIMITED TABLESPACE FROM myuser;

GRANT CREATE SESSION, CREATE TABLE TO myuser;


.
CREATE TABLESPACE myspace
DATAFILE 'C:\oracle\tables\tb.dbf' SIZE 30M;

CREATE USER myuser IDENTIFIED BY mypassword
DEFAULT TABLESPACE myspace
QUOTA UNLIMITED ON myspace;

Create table mytable(name varchar2(50),staff_no number primary key)
Alter table mytable add(age number);
Alter table mytable drop column age;

Alter table mytable enable constraint constr_maxval;

alter table mytable add constraint constraint  uk_staff_no UNIQUE(STAFF_NO);






to_date,('1-3-2012','mm/dd/yyyy')
round(x,2)
tunc(x,2)
ceil,floor,avg,count,max




No comments:

Post a Comment