Nebyly nalezeny žádné výsledky

Vašemu vyhledávání neodpovídají žádné výsledky.

Abyste našli to, co hledáte, doporučujeme vyzkoušet následující postup:

  • Zkontrolujte pravopis vašich klíčových slov ve vyhledávání.
  • Použijte synonyma pro klíčové slovo, které jste zadali, například zkuste „aplikace“ místo „software“.
  • Vyzkoušejte jedno z populárních vyhledávání uvedených níže.
  • Zahajte nové hledání.
Časté otázky

Getting Started using Oracle Developer Tools for VS Code

Welcome! Oracle Developer Tools for VS Code enables Visual Studio Code developers to connect to Oracle Database and Oracle Autonomous Database, edit SQL and PL/SQL with autocomplete, intellisense, syntax coloring, and code snippets, execute SQL and PL/SQL and view and save the results in formats such as .CSV and JSON. The Oracle Database Explorer tree control allows you to quickly explore your database schema, view table data, and edit, execute and save PL/SQL.

This Quick Start will help you install, connect, configure and get started using Oracle Developer Tools for VS Code.

Note: This document assumes you are using version 19.3.3 (released 9/30/2020). Follow the instructions below to update if you are using an older version.

Quick Start

 

Install

  • Click on the Extensions icon in the Activity Bar on the side of VS Code or use the View: Show Extensions command (Ctrl+Shift+X)
  • Type Oracle in the extension search bar
  • Locate Oracle Developer Tools for VS Code and click Install
  • When the installation is complete, restart Visual Studio Code
  • During the installation, you may be prompted to install .NET Core Runtime. (.NET Core Runtime version 2.1 will work, but version 3.1 is preferred. Any other runtime version is not sufficient. Version 3.1 is required for macOS users wishing to connect to Oracle Autonomous Database.) Installation links are below:

Update this Extension

  • Visual Studio Code automatically checks for extension updates and installs them. After updating you will be prompted to restart Visual Studio Code.
  • If you have disabled automatic updates, press F1 to open the Command Palette and enter the Check for Extension Updates command and click the Update... button which will appear in the list of installed extensions. For more information click here.
  • macOS users wishing to connect to Oracle Autonomous Database should install .NET Core Runtime version 3.1.

Explore Database Schema with Oracle Database Explorer

  • To view Database Explorer, click the database icon in the Activity Bar on the far left side of Visual Studio Code.
    • Connect: Click the plus sign button to create a new connection, following the steps below to Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias. Once connection nodes display, you can click on the node to view the database schema.
    • Delete Connection: Right click on any connection node and select Delete
    • Update Connection info: Right click on any connection node and select Update
    • Disconnect: Right click on any connection node and select Disconnect
    • View Other Users/Other Schemas: Click to expand the Other Users node. Select the schema you wish to view. Alternately, click on the connection node and select Update. In the connection dialog, check the Show more options checkbox then select a different schema in the Current Schema dropdown. Press the Update Connection button.
    • View and Save Table/View Data: On a Table and View node's menu, select Show Data. For more information see View and Save Result Sets below.
    • Edit PL/SQL: On stored procedures, functions, packages, or trigger nodes select Edit/Edit Package Body/Edit Specification to open PL/SQL into a file for editing. See Edit Existing PL/SQL in your Database below for more details.
    • Save PL/SQL to database: If the PL/SQL file was opened with the Edit PL/SQL menu item, you can save changes to the database by right clicking in the PL/SQL code and selecting Save to Database
    • Save PL/SQL to file: Select the tab with the PL/SQL code in it. In Visual Studio Code menu select File->Save As
    • Execute PL/SQL: From menu, select Run to execute a stored procedure or function
    • Refresh: Right click on any node and select Refresh to refresh that node and all child nodes
    • Filter: After expanding a long list of nodes (for example, all relational tables) you can filter them by mousing over any part of Oracle Database Explorer and typing a string, then press return. This will highlight all matches for that string. You can then click on the hamburger icon to only show matches in Oracle Database Explorer.

Connect to Oracle Database

  • (If your database is in the Oracle Cloud go to Connect to Oracle Autonomous Database below)
  • To connect to Oracle Database from a .SQL or .PL/SQL file, press F1 to open Command Palette and select Oracle:Connect from the dropdown
  • To connect from Oracle Database Explorer, click the plus sign button
  • A connection dialog will open. In the Connection Type dropdown, select Basic
  • Enter the database hostname, port number and service name
  • Select the database role from the Role drop down list
  • Enter the username and password
  • If you are using Proxy Authentication, check the Show more options checkbox and provide the proxy username and password
  • If you wish to use a different schema than the default schema associated with your username, check the Show more options checkbox and select the schema name from the Current Schema dropdown
  • Provide a connection name to be used to reference this connection in Database Explorer and elsewhere
  • Click the Create Connection button

Connect using a TNSNAMES.ORA Connection Alias

  • Copy the TNSNAMES.ORA file that you want to use into the directory that is set as Config Files Folder in the Oracle Developer Tools for VS Code Extension Settings, or change this setting as desired. By default this location is ~/Oracle/network/admin on Linux and Mac and %USERPROFILE%\Oracle\network\admin on Windows.
  • If you don't have a TNSNAMES.ORA but would like to create one, see the example located in ~/.vscode/extensions/oracle.oracledevtools-19.3.3/sample/network on Linux and Mac and %USERPROFILE%\.vscode\extensions\oracle.oracledevtools-19.3.3\sample\network on Windows .
  • To connect to Oracle Database from a .SQL or .PL/SQL file, press F1 to open Command Palette and select Oracle:Connect from the dropdown
  • To connect from Oracle Database Explorer, click the plus sign button
  • A connection dialog will open. In the Connection Type dropdown, select TNS Alias
  • Make sure the TNS Admin Location field is set to the directory where your TNSNAMES.ORA file is located. If not, change it.
  • Select an alias from the TNS Alias dropdown list
  • Select the database role from the Role drop down list
  • Enter the username and password
  • If you are using Proxy Authentication, check the Show more options checkbox and provide the proxy username and password
  • If you wish to use a different schema than the default schema associated with your username, check the Show more options checkbox and select the schema name from the Current Schema dropdown
  • Provide a connection name to be used to reference this connection in Database Explorer and elsewhere
  • Click the Create Connection button

Connect to Oracle Autonomous Database

  • Obtain your Client Credentials File: Go to the Administration Console for your Oracle Autonomous Database and click Download Client Credentials.  Alternatively, obtain the credentials file from your administrator.
  • Unzip the credentials files into the directory that is set as Config Files Folder in the Oracle Developer Tools for VS Code Extension Settings. By default this location is ~/Oracle/network/admin on Linux and Mac and %USERPROFILE%\Oracle\network\admin on Windows.
  • To connect to Oracle Database from a .SQL or .PL/SQL file, press F1 to open Command Palette and select Oracle:Connect from the dropdown
  • To connect from Oracle Database Explorer, click the plus sign button
  • A connection dialog will open. In the Connection Type dropdown, select TNS Alias
  • Make sure the TNS Admin Location field is set to the directory where you unzipped your credentials files. If not, change it.
  • Check the Use Wallet File checkbox
  • Make sure the Wallet File Location field is set to the directory where you unzipped your credentials files. If not, change it.
  • Select the alias name you wish to connect to, for example mydb_high, from the TNS Alias dropdown list.
  • Select Non-Administrator from the Role drop down list
  • Enter the username and password. (If you are new to Oracle Autonomous Database, use username ADMIN)
  • If you are using Proxy Authentication, check the Show more options checkbox and provide the proxy username and password
  • If you want to use a different schema than the default schema associated with your username, select it from the Current Schema dropdown
  • Provide a connection name to be used to reference this connection in Database Explorer and elsewhere
  • Click the Create Connection button
  • If you are using macOS, and receive a Connection request timed out error when trying to connect, please update .NET Core Runtime to version 3.1. Any other version is not sufficient.

Connect Using a Proxy User

  • Follow the steps in Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias above to open the connection dialog and provide the connection information
  • In the connection dialog, check the Show more options checkbox and provide the proxy username and password

Connect Using OS Authentication

  • If using both Windows Client and Windows Database Server, set SQLNET.AUTHENTICATION_SERVICES=(NTS) in a SQLNET.ORA file located in the directory that is set as Config Files Folder in the Oracle Developer Tools for VS Code Extension Settings. By default this location is %USERPROFILE%\Oracle\network\admin
  • Follow the steps in Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias above, except
  • When prompted for a user id enter "/" (without the quotes).

Change the Default Schema for a Connection

  • To use a different schema than the default for the user you logged in as (for example, you logged in as ADMIN but want to default to using the HR schema when executing SQL or when browsing with Oracle Explorer), follow the steps in Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias above to open the connection dialog and provide the connection information
  • In the connection dialog, check the Show more options checkbox and then select a different schema in the Current Schema dropdown
  • .

View other Schemas in Oracle Explorer

  • In Oracle Explorer, click to expand the Other Users node. Select the schema you wish to view.
  • If you will mostly be using the alternate schema and wish it to be the default schema shown in Oracle Explorer, follow the steps above to Change the Default Schema for a Connection
  • .

Edit Existing PL/SQL in your Database

  • View Database Explorer by clicking the database icon in the Activity Bar on the far left side of Visual Studio Code.
  • If the Database Explorer pane is empty (no connection nodes showing), click the plus sign button to create a new connection, following the steps above to Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias. Once connection nodes display, you can click on the node to view the database schema.
  • Navigate in the tree control to the PL/SQL package, stored procedure/function, or trigger you want to edit.
  • Right click on the PL/SQL package, stored procedure/function, or trigger and select Edit/Edit Package Body/Edit Specification to open PL/SQL into a file for editing.
  • When done editing, right click in the PL/SQL code and select Save to Database

Open Existing .SQL or .PL/SQL File

  • In Oracle Explorer, right click on a connection node and select Open Existing SQL File.
  • If a connection does not exist, create a new one by pressing the plus (+) icon and using the steps in Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias above.
  • (Note:You can save PL/SQL in your database to a file by going to Oracle Database Explorer, opening a package, procedure, function, or trigger in the Explorer and then in Visual Studio Code menu select File->Save As)

Change Database Connection for an Open .SQL or .PL/SQL File

  • Press F1 to open Command Palette and select Oracle:Update Connection from the dropdown
  • If prompted, select Oracle-SQL and PLSQL from the languages dropdown.
  • Select an existing connection profile from the list or create a new one using the steps in Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias above.

Create a New .SQL or .PLSQL File

  • In Oracle Explorer, right click on a existing connection node and select Open New SQL File. If a connection does not exist, create a new one by pressing the plus (+) icon and using the steps in Connect to Oracle Database or Connect using a TNSNAMES.ORA Connection Alias above.
  • Alternately, Press F1 to open Command Palette and select Oracle:Develop New SQL or PLSQL from the dropdown. Select an existing connection profile from the list or create a new one
  • When done editing, in the VS Code menu select File->Save As to save the file.
  • Alternately, you may execute the SQL*Plus CONNECT command. This command will associate the file with the connection specified in the command.

Execute SQL and PL/SQL

  • Type some SQL or PL/SQL you wish to execute into the .SQL or .PLSQL file
  • While typing, autocompletion suggestions will appear as you type, for example column names. You can click the i icon in the suggestions to get more details such as the schema objects the suggestion is associated with. Use the arrow keys to navigate through the suggestions, and the enter key to select a suggestion.
  • Type a schema name followed by a period, for example HR. to use intellisense to view and select database objects.
  • While typing, some code snippet suggestions may appear. You can view more snippets by typing oracle on a new line.
  • Position the cursor on a line that contains the SQL or PL/SQL that you wish to execute. Alternately, you can select (highlight) one or more SQL or PL/SQL statements. Right click and select Execute SQL from the menu. Select Execute All if you wish to execute all SQL and PL/SQL in the current file.
  • After executing SQL, a new document (Results Window) will open or the results will be appended to an open Results window. The maximum number of rows that can be returned is controlled by the Max Rows extension setting. As you scroll through the rows, more will be fetched - up to this maximum.
  • To clear the results window, click the Clear Results Window button located in the area near the document tabs. To change the default to always clear the results window after every execution, change the Clear Results Window extension setting.
  • By default, SQL statements will automatically commit (auto commit is on). To change this, see Disable/Enable Auto Commit in the section below.
  • In addition to SQL and PL/SQL, you can enter SQL*Plus commands as well. For more information see the Executing SQL*Plus Commands section below and visit Using SQL*Plus Commands with Oracle Developer Tools for VS Code

Executing SQL*Plus Commands

  • SQL*Plus commands provide useful functionality such as connecting and disconnecting, enabling and disabling autocommit, running other SQL*Plus scripts , describing database object metadata, defining and using substitution variables, defining and using bind variables, controlling output display size, saving script output to a file, and more. To execute SQL*Plus commands do the following:
  • Type a SQL*Plus command into the .SQL or .PLSQL file
  • While typing, autocompletion suggestions will appear as you type
  • Select (highlight) one or more SQL*Plus commands and SQL or PL/SQL statements. Right click and select Execute SQL from the menu. Select Execute All if you wish to execute all SQL*Plus commands, SQL, and PL/SQL in the current file.
  • If one more more SQL*Plus commands are not supported, you will receive a warning message
  • The SQL*Plus CONNECT command will associate the file with the connection specified in the command. After executing this command, intellisense/autocomplete will use the new connection and schema.
  • For more information, including a reference guide of supported SQL*Plus commands, visit Using SQL*Plus Commands with Oracle Developer Tools for VS Code

Disable/Enable Auto Commit

  • When executing multiple SQL statements (for example, running a script), auto commit automatically commits work after each statement. If auto commit is disabled, an explicit COMMIT or ROLLBACK statement can be used to control the behavior
  • In your SQL file, enter SET AUTOCOMMIT OFF or SET AUTOCOMMIT ON and then right click and select Execute SQL from the menu. This autocommit setting will be in effect for the life of your connection and will override the default extension setting.
  • To set the default for all SQL files opened with this extension, Press F1 to open the Command Palette and enter Preferences: Open Settings (UI) command
  • Expand the Extensions node and select Oracle Developer Tools for VS Code Configuration.
  • Check the SQLPlus:Auto Commit checkbox to enable auto commit and uncheck it to disable it

View and Save Result Sets

  • After executing SQL, a new document (Results Window) will open with the result set or the results will be appended to an open Results window. The maximum number of rows that can be returned is controlled by the Max Rows extension setting. As you scroll through the rows, more will be fetched - up to this maximum.
  • To save results, choose the format: .CSV or JSON. Then click the icon to Save Selected Rows or Save All Rows. After providing a file name and location, the file will open in Visual Studio Code.
  • To copy the selected rows to the clipboard, click the Copy Selected Row(s) to Clipboard icon
  • To clear the results window, click the Clear Results Window button located in the area near the document tabs. To change the default to always clear the results window after every execution, change the Clear Results Window extension setting.

View SQL History

  • In Oracle Explorer, click on the History control to open it.
  • Expand the connection name for which you want to see the history. Previously executed SQL commands from this session will be listed.
  • Hover over a long SQL statement to view a tooltip containing the complete statement.
  • To execute a SQL statement directly from the history, right click on it and select Run.
  • To copy the SQL to an open editor, right click on it and select Copy to Editor.
  • SQL history does not persist across sessions. For permanent storage, save the SQL as a bookmark by right clicking and selecting Bookmark SQL from the menu.

Create a SQL Bookmark

  • Select one or more lines of SQL or PL/SQL in the editor, right click and select Bookmark SQL from the menu
  • Provide a bookmark name and a folder name
  • In Oracle Explorer, click on the Bookmarks control to open it.
  • Expand the folder name. Bookmarks will be listed.
  • Hover over a bookmark to view a tooltip containing the complete statement.
  • To execute the SQL statement directly, right click on the bookmark and select Run.
  • To copy the SQL to an open editor, click on the bookmark.
  • To copy the SQL to a new SQL file, right click on the bookmark and choose Open in Editor from the menu.

Use a Horizontal Editor Layout

  • To modify the default window layout of Visual Studio Code to split the screen horizontally, for example to have a .SQL file in an upper pane and the SQL execution results in a lower pane, do the following:
  • In the VS Code menu, select View->Editor Layout->Two Rows.
  • Execute some SQL or PL/SQL as described above in Execute SQL and PL/SQL
  • Drag the SQL results tab into the lower pane.
  • Any additional SQL executions will continue to be displayed in this tab in the lower pane until it is closed.

Create or Modify Keyboard Shortcuts

  • To create keyboard shortcuts (keybindings) or to modify existing ones, go to the File menu in VS Code and select Preferences->Keyboard Shortcuts
  • In the search text box, enter a portion of the name of the extension whose shortcut you would like to modify, for example "oracle".
  • A list of commands and their shortcuts will appear. Click the pencil icon on the left side of a row to edit a shortcut, or + (plus sign) to create a new one.
  • When prompted, enter the key combination and if it is not being used by another extension, press enter. If it is being used by another extension, press escape and try again.
  • To delete a shortcut, right click on the shortcut and select Remove Keybinding

Learn What's New in Version 19.3.3

Get Help or Provide Feedback