Top Banner
Print Preview Using Source Code Control in Oracle SQL Developer This tutorial contains the following sections: Purpose Time to Complete Overview Prerequisites Creating a Database Connection Viewing the Files to be Versioned Creating a Repository Importing the Files to be Versioned Working with the Files under Version Control Summary Viewing Screenshots Click icon to hide all screenshots Note: Alternatively, you can click an individual icon (or image) associated with each step to view (or hide) the screenshot associated with that step. Using Source Code Control in Oracle SQL Developer Purpose This tutorial shows how to use the source code control feature in Oracle SQL Developer. Time to Complete Approximately 15 mins Overview Oracle SQL Developer is a free graphical tool that enhances productivity and simplifies database development tasks. Using Oracle SQL Developer, you can browse database objects, run SQL statements, edit and debug PL/SQL statements and run reports, whether provided or created. Developed in Java, Oracle SQL Developer runs on Windows, Linux and the Mac OS X. This is a great advantage to the increasing number of developers using alternative platforms. Oracle SQL Developer is built on an extensible framework and, as such, is extensible itself. You can create basic XML extensions or more involved Java extensions to add utilities or other functionality to the product. You can use the version control feature of SQL Developer to import files into your source control system, check them out, modify and commit the changes back. Prerequisites Before starting this tutorial, you should: Install Oracle SQL Developer 3.0 from OTN. Follow the release notes here. Install the Oracle Database 11g. Unlock the HR user. Login to SQL Developer 3.0 as the SYS user and execute the following command: alter user hr identified by hr account unlock; Download and unzip the sql_files.zip file that contains all the files you need to perform this tutorial. Creating a Database Connection Note: If you already have a database connection, you do not need to perform the following steps, instead, you can move to the Viewing the Files to be Versioned section. 1 . If you installed the SQL Developer icon on your desktop, click the icon to start your SQL Developer and move 3. If you do not have the icon located on your desktop, perform the following steps to create a shortcut to laun Developer 3.0 directly from your desktop. Open the directory where SQL Developer 3.0 is located, right-click sqldeveloper.exe (on Windows) or sqldeveloper.sh (on Linux) and select Send to > Desktop (create shortcut). Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev... 1 of 13 10/10/2011 17:59
13
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

Using Source Code Control in Oracle SQL Developer

PurposeThis tutorial shows how to use the source code control feature in Oracle SQL Developer.

Time to Complete

Approximately 15 mins

OverviewOracle SQL Developer is a free graphical tool that enhances productivity and simplifies database developmenttasks. Using Oracle SQL Developer, you can browse database objects, run SQL statements, edit and debugPL/SQL statements and run reports, whether provided or created.

Developed in Java, Oracle SQL Developer runs on Windows, Linux and the Mac OS X. This is a greatadvantage to the increasing number of developers using alternative platforms. Oracle SQL Developer is built onan extensible framework and, as such, is extensible itself. You can create basic XML extensions or moreinvolved Java extensions to add utilities or other functionality to the product.

You can use the version control feature of SQL Developer to import files into your source control system, checkthem out, modify and commit the changes back.

PrerequisitesBefore starting this tutorial, you should:

Install Oracle SQL Developer 3.0 from OTN. Follow the release notes here.Install the Oracle Database 11g.Unlock the HR user. Login to SQL Developer 3.0 as the SYS user and execute the following command:alter user hr identified by hr account unlock;Download and unzip the sql_files.zip file that contains all the files you need to perform this tutorial.

Creating a Database ConnectionNote: If you already have a database connection, you do not need to perform the following steps, instead, youcan move to the Viewing the Files to be Versioned section.

1 . If you installed the SQL Developer icon on your desktop, click the icon to start your SQL Developer and move to Step3. If you do not have the icon located on your desktop, perform the following steps to create a shortcut to launch SQLDeveloper 3.0 directly from your desktop.

Open the directory where SQL Developer 3.0 is located, right-click sqldeveloper.exe (on Windows) orsqldeveloper.sh (on Linux) and select Send to > Desktop (create shortcut).

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

1 of 13 10/10/2011 17:59

Page 2: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

2 . On the desktop, you will find an icon named Shortcut to sqldeveloper.exe. Double-click the icon to open SQLDeveloper 3.0.

Note: To rename it, select the icon and then press F2 and enter a new name.

3 . In the Connections tab, right-click Connections and select New Connection.

Note: If this tab is not visible, select View > Connections.

4 . Enter the following and click Test:

Connection Name: HR_ORCLUsername: hrPassword: <your_password>Select Save Password checkboxHostname: localhostPort: 1521SID: <your_SID>

Viewing the Files to be VersionedYou can view the files stored in your local file system by using the Files navigator. To view the files to beversioned, perform the following steps:

1 . Click View > Files.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

2 of 13 10/10/2011 17:59

Page 3: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

2 . The Files navigator appears.

3 . In the Files navigator, navigate to the directory where you unzipped the files from the Prerequisites section and openthe file PROC_EMP_CURSOR.sql.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

3 of 13 10/10/2011 17:59

Page 4: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

Creating a RepositoryTo create a Subversion repository, perform the following steps:

Note: If you already have a Subversion repository, you can skip this step.

1 . Click Versioning > Create Local Repository....

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

4 of 13 10/10/2011 17:59

Page 5: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

2 . Provide C:\repos as the Repository Path and HR_ORCL as the Connection Name. Then click OK.

3 . Expand the Subversion node in the Versioning Navigator. The repository for the HR_ORCL connection is created.

4 . Right-click HR_ORCL connection and select New Remote Directory... .

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

5 of 13 10/10/2011 17:59

Page 6: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

5 . Enter the name SQLFiles and click OK.

Importing the Files to be Versioned

To import the files to be versioned into the Subversion repository, perform the following steps:

1 . In the Files navigator, select the directory where you unzipped the files from the Prerequisites section under thetab.

2 . Click Versioning > Import Files....

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

6 of 13 10/10/2011 17:59

Page 7: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

3 . In the Welcome page of the Import to Subversion wizard, click Next.

4 . Ensure that HR_ORCL[file:///C:/repos] is the destination repository connection. Select the node SQLFiles and clickNext.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

7 of 13 10/10/2011 17:59

Page 8: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

5 . Click Browse and select the directory where you unzipped the files from the Prerequisites section as the sourcedirectory. Click Next.

6 . In the Filters page, click Next.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

8 of 13 10/10/2011 17:59

Page 9: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

7 . In the Options page, select Perform Checkout check box and click Next.

8 . Review the options for the Import operation and click Finish.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

9 of 13 10/10/2011 17:59

Page 10: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

9 . In the Versioning Navigator, expand HR_ORCL > SQLFiles.

10 . You can now see the files in your Subversion Repository.

Working with the Files under Version Control

To work on the files that are placed under version control, perform the following steps:

1 . In the Files Navigator, expand the directory where you unzipped the files from the Prerequisites section. Notice thecheck out icon indicating that the files in this directory have been checked out.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

10 of 13 10/10/2011 17:59

Page 11: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

2 . Double-click PROC_EMP_CURSOR.sql file.

3 . Delete the EXCEPTION block.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

11 of 13 10/10/2011 17:59

Page 12: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

4 . Add the following comment and click the Save icon.

--To add an exception block type excep and the press Ctrl+Shift+t.

5 . Click History.

6 . The History tab displays the changes you have done to PROC_EMP_CURSOR.sql. You can right-click on a versionand move between the various changes.

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

12 of 13 10/10/2011 17:59

Page 13: Using Source Code Control

Print Preview

Using Source Code Control inOracle SQL DeveloperThis tutorial contains the following sections:

PurposeTime to CompleteOverviewPrerequisitesCreating a Database ConnectionViewing the Files to be VersionedCreating a RepositoryImporting the Files to be VersionedWorking with the Files under Version ControlSummary

Viewing Screenshots

Click icon to hide all screenshots

Note: Alternatively, you can click an individual icon(or image) associated with each step to view (orhide) the screenshot associated with that step.

7 . To check-in the file, in the File Navigator, right-click the file PROC_EMP_CURSOR.sql and select Versioning >Commit.

8 . Click OK in the Commit Resources window.SummaryIn this tutorial, you have learned how to:

Create a Database ConnectionView the Files to be VersionedCreate a RepositoryImport the Files to be VersionedWork with the Files Under Version Control

About Oracle |Oracle and Sun | | Careers | Contact Us | SiteMaps | Legal Notices | Terms of Use | Your Privacy Rights

Using Source Code Control http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev...

13 of 13 10/10/2011 17:59