Oracle Installation Basics

Source: Internet
Author: User

1. The following steps: Start key--Enter run-in Sqlplus enter username: sys input password: SYS as SYSDBA//NOTE: The password entered here must follow the as SYSDBA.      sql> alter user Scott account unlock; The user has changed.      Sql> commit; Submit complete. Sql> Conn Scott/tiger change Scott password new password: Tiger Retype the new password: Tiger password changed connected. Complete.

2.//View the global database name

SELECT * from Global_name;

3.//oracle build table Set Primary key auto-increment

First create a table

CREATE TABLE member (MemberID number primary key, Membermail varchar2 () not NULL, MemberName VARCHAR2 (a) not NULL, Membe   Rpassword varchar2 (20)); Then, you need a custom sequence

CREATE SEQUENCE emp_sequence INCREMENT by 1--add several start with 1 each--counting from 1 nomaxvalue--not setting maximum nocycle--always accumulating, not looping NOCAC HE--Do not build buffers you only have tables and sequences that are not enough, and you need a trigger to execute it! The code is as follows:

Create trigger Mem_trig before insert on member for each row if (New.memberid is null) BEGIN select Emp_sequence.next    Val into:new.memberId from dual; End

So you can, insert data test INSERT INTO member (Membermail,membername,memberpassword) VALUES ('[email protected]', ' Jack ', ' 123456 ');

4.//Open the connection oracleconnection connection = new OracleConnection ("Server=ora; User Id=scott; Password = Tiger; "); Connection.   Open (); Create a command oraclecommand command = new OracleCommand (); Command.   Connection = Connection; Set the CommandType property to execute//stored procedures or functions by this command command.   CommandType = System.Data.CommandType.StoredProcedure; Set the name of procedure or function to is executed command.   CommandText = "Get_all_depts_proc"; The Parametercheck property should is true to automatically//check the parameters needed for the procedure execution. Command.   Parametercheck = true; At this moment, the command was ready for execution. As we have an output cursor parameter, we could use the command to fill a data table. Oracledatatable dt = new oracledatatable (command, connection); Dt. Fill ();

Oracle Installation Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.