Size: 994
Comment:
|
Size: 2801
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
JDBC driver for Java 1.6: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html | JDBC driver for JDK 1.6 (ojdbc6.jar): http://download.oracle.com/otn/utilities_drivers/jdbc/11204/ojdbc6.jar == Maven local repository install == mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true {{{#!highlight xml <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.3</version> </dependency> }}} |
Line 15: | Line 26: |
SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME='AAA'; |
|
Line 37: | Line 50: |
== Partinioning == http://www.orafaq.com/wiki/Interval_partitioning http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin005.htm http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm {{{#!highlight sql select table_name,partition_name,num_rows from user_tab_partitions where table_name='TEST'; }}} Other views: * DBA_TAB_PARTITIONS * ALL_TAB_PARTITIONS * USER_TAB_PARTITIONS == Sequence creation == {{{#!highlight sql CREATE SEQUENCE sample_seq START WITH 1 INCREMENT BY 1; CREATE SEQUENCE sample_seq2 MINVALUE 1 START WITH 1 INCREMENT BY 1; SELECT * FROM ALL_SEQUENCES; -- show all sequences }}} == User and table space creation in Oracle XE == {{{#!highlight sql -- login with system user create tablespace christs datafile 'c:\christs.dbf' size 100m; create user chris identified by 12345678 default tablespace christs; alter user chris quota unlimited on christs; grant create session to chris; grant create table to chris; -- login with user chris create table CHRIS.test ( name varchar(255) ) tablespace chris; insert into CHRIS.test (name) values('Test name 1234'); -- login with system user -- user alice to just run selects create user alice identified by 12345678 default tablespace christs; grant create session to alice; grant select on CHRIS.test to alice; -- login with alice select * from CHRIS.test; }}} |
Oracle
http://docs.oracle.com/cd/B19306_01/index.htm
JDBC driver for JDK 1.6 (ojdbc6.jar): http://download.oracle.com/otn/utilities_drivers/jdbc/11204/ojdbc6.jar
Maven local repository install
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true
Get schemas in DB
1 SELECT DISTINCT USERNAME FROM DBA_USERS;
Get columns from table
Get indexes from table
http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_1069.htm
Get code from stored procedure
Show schema and table
Partinioning
http://www.orafaq.com/wiki/Interval_partitioning
http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin005.htm
http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm
Other views:
- DBA_TAB_PARTITIONS
- ALL_TAB_PARTITIONS
- USER_TAB_PARTITIONS
Sequence creation
User and table space creation in Oracle XE
1 -- login with system user
2 create tablespace christs datafile 'c:\christs.dbf' size 100m;
3 create user chris identified by 12345678 default tablespace christs;
4 alter user chris quota unlimited on christs;
5 grant create session to chris;
6 grant create table to chris;
7
8 -- login with user chris
9 create table CHRIS.test ( name varchar(255) ) tablespace chris;
10 insert into CHRIS.test (name) values('Test name 1234');
11
12 -- login with system user
13 -- user alice to just run selects
14 create user alice identified by 12345678 default tablespace christs;
15 grant create session to alice;
16 grant select on CHRIS.test to alice;
17
18 -- login with alice
19 select * from CHRIS.test;