Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1
1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ALM with Visual Studio: SQL
and PL/SQL Development,
Source Control, and
Deployment
Christian Shay
Product Manager, Oracle
Program Agenda

SQL and PL/SQL Development Lifecycle
– Overview
– Create Development Database - Oracle Multitenant
– Create Users, Roles and Grant Privileges
– Creating Schema Objects
– Visual Studio Source Control Integration
– PL/SQL and SQL Editing
– SQL and Performance Tuning
– PL/SQL Debugging in Visual Studio
– Schema Compare and Deployment
3
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
<Insert Picture Here>
.NET Developer Center on OTN
 http://otn.oracle.com/dotnet
 Free downloads of Visual Studio tools, ODP.NET
 Whitepapers, Sample code
 Demo Videos
 Help Forums
 New Feature request page
 Latest Oracle on .NET News
4
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle .NET Development Environment
Oracle Developer Tools
for Visual Studio
Oracle Data Provider
for .NET
Application
Development
.NET
Framework
Visual
Studio
Deploy
Database
Development
Oracle Database
Extensions for .NET
5
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Deploy
Web or
Client/Server
Oracle Providers for
ASP.NET
Oracle Application Development Lifecycle
Deploy
Tune
Test
Create
Development
Database
.NET Coding
6
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
PL/SQL and
SQL
Editing/Debug
Source
Control
Application Development Lifecycle Overview
 Oracle Developer Tools for Visual Studio
– Tightly integrated “Add-in” for Visual Studio 2012 and 2010
 ODP.NET
– ADO.NET compliant data provider
– Native access to Oracle database
– Utilize advanced Oracle Database features
 RAC, performance, security, data types, XML, etc.
 Both available for free download today
– http://otn.oracle.com/dotnet
7
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Create Development Database
 SQL Plus script
 Oracle Multitenant
8
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Multitenant Architecture
Components of a Multitenant Container Database (CDB)
PDBs
Root
Pluggable Databases (PDBs)
CDB
9
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Multitenant for Test and Development
Clone production, plug into development. Clone/destroy test instances
10
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
PDB Functionality in Server Explorer
 Pluggable Databases Node
– New pluggable database: Fast provisioning from the seed
– Plug: Plug in an XML file and some DBFs
 Pluggable Databases Node
– Clone: Fast copy
– Unplug: Removes PDB from CDB and creates XML manifest
– Open, Close: Equivalent to Startup and Shutdown
– Delete: Removes PDB from CDB and deletes files
11
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Connect to PDBs in Server Explorer
 Server Explorer connections automatically made to new
or cloned pluggable databases
– TNSNAMES.ORA updated and connection to ADMIN made
 No Server Explorer connection made when plugging in
– Need to update TNSNAMES.ORA
– Connect descriptor same as container, but
 service_name = pdb name
12
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Multitenant with ODP.NET
 ODP.NET works implicitly with PDBs
– Connect to the Service_name of the PDB
– Hostname and port are same as container
 Requires Oracle Database 12c and ODAC 12c
13
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
Multitenant
14
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Create Users, Roles and Grant Privileges

User Designer
 Role Designer
 Grant and Revoke Privileges Dialog
15
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
User/Role Designer
Privileges Wizard
16
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Create Schema Objects

Oracle Wizards
–
Table Designer
–
PL/SQL Package Wizard
–
Table Import Wizard to import data
–
..many others (one Wizard/Designer for every schema type)

Query Window
 Run SQL*Plus Script
17
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
Creating Schema
Objects
18
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Visual Studio Source Control Integration

Configure Source Control in Visual Studio
 Oracle Database Project
 Generate Create Script to Source Control
19
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
Source Control
Integration
20
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
PL/SQL and SQL Editing


21
Oracle PL/SQL Editor – database based
–
Collapsible Regions
–
Syntax Coloring
–
Integrated Online Help
–
Supports Debugging
Oracle SQL Editor – file based
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
SQL and
PL/SQL Editors
22
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Performance Tuning in Visual Studio –
SQL Tuning Advisor
•
•
•
•
23
Use when designing new SQL statements
Tune ad-hoc SQL statements in Query Window
Tune bad SQL found by Oracle Performance Analyzer
Use if SQL is performing poorly under load
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
SQL Tuning Advisor
• Requirements
– ADVISOR privilege
– Oracle Database license for Oracle Diagnostic Pack
– Oracle Database license for the Oracle Tuning Pack
• How to run:
– Oracle Query Window “Tune SQL” button
– Oracle Performance Monitor – Tune SQL button
24
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
SQL Tuning Advisor
• Implement Findings Button
– Automatically fix the problem for certain finding types
• View Report Button
– View more details about how to fix a problem
25
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Performance Tuning in Visual Studio –
Oracle Performance Analyzer
• Detects performance issues in an application’s use of
the database under load
• Requirements
– SYSDBA
– Oracle Database license for Oracle Diagnostic Pack
• Can be use during testing
• Can be also used on production applications
26
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
SQL Tuning
Advisor
27
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Performance Analyzer
28
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Performance Analyzer
• Simple to use
–
–
–
–
–
–
29
Run your application
Enter amount of time to analyze
Press Start to start timer
Sufficient “database time” required to get results
View findings and actions
Implement recommended actions
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
AWR and ADDM
• Built into the Oracle Database 10g
• Automatic Workload Repository (AWR)
– Evolution of statspack
– Built-in repository
– Captures performance statistics at regular intervals
• Automatic Database Diagnostic Monitor (ADDM)
– Methodically analyses captured AWR stats
– Generates recommendations
30
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
AWR and ADDM
• AWR Snapshots
– A collection of database statistics and performance metrics
gathered at a single point in time.
– Two snapshots make up one analysis time period
– Oracle Database automatically takes periodic snapshots
• ADDM Tasks
– An analysis of Oracle database performance over a period of
time
– Requires two AWR Snapshots to define that time period
31
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
AWR and ADDM in Visual Studio
• AWR Snapshots
– New AWR Snapshot Dialog
– AWR Snapshots Node in Server Explorer
• ADDM Tasks
– New ADDM Task Dialog
– ADDM Tasks Node in Server Explorer
– ADDM Task results are displayed in Oracle Performance
Analyzer
32
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
Performance
Analyzer
33
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Performance Analyzer
• “Manual” Method, instead of using Timer
–
–
–
–
–
–
34
Run your application
Create a Snapshot, via “New AWR Snapshot” dialog
Wait desired time period
Create second snapshot
Create ADDM Task, via “New ADDM Task” dialog
View Results. If insufficient database time, wait a while and
create one more snapshot and another ADDM task
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Performance Analyzer
• Manual Method Pros
– Can close Visual Studio during time period
– If insufficient database time, you can extend the time period by
creating one more snapshot, without having to wait entire
duration again
– Can use database created AWR Snapshots if desired
– Can elect to monitor all statistics when creating the snapshots
35
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
PL/SQL Debugging - Configuration
 GRANT debug privileges as SYSDBA
– 9.2 or later: GRANT DEBUG ANY PROCEDURE TO username,
and
– 10g or later also requires: GRANT DEBUG CONNECT
SESSION TO username
 Set port range and IP in Debugging Options page
– Tools -> Options->Oracle Developer Tools
 Compile PL/SQL units for Debug
– Via menu in PL/SQL editor or in Oracle Explorer
36
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
PL/SQL Debugging - Configuration
 New requirement in 12c:
– SYSDBA must grant ACL access on
 IP Address
 Port Range
 Schema name
 Use new “Grant Debugging Privileges dialog”
– Right click on Schema name to be granted both debugging roles
and the ACL privileges
37
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
PL/SQL Debugging - Configuration
 Or issue this PL/SQL as SYSDBA:
 BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
HOST => ‘127.0.0.1',
LOWER_PORT => 65000,
UPPER_PORT => 65300,
ACE => XS$ACE_TYPE(PRIVILEGE_LIST =>
XS$NAME_LIST('jdwp'),
PRINCIPAL_NAME => 'HR',
PRINCIPAL_TYPE => XS_ACL.PTYPE_DB));
END;
38
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Direct Database Debugging
 Debug directly inside the database, no application code
 “Step Into” from Server Explorer
 “Run Debug” from Server Explorer
 Enter parameters manually
– Not useful with array parameters or complex types
39
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Application Debugging Mode
 Step from .NET code into PL/SQL and back from one
instance of Visual Studio
 Useful for client server code (not web apps)
 Check off “Tools -> Oracle Application Debugging”
 ODT automatically starts listener using port in range
given in Options page
 Uncheck "Enable the Visual Studio hosting process" in
the .NET Project Properties Debug tab
40
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
External Application Debugging
 Dedicated VS instance for debugging PL/SQL only
– Use additional VS instance for any .NET code (eg ASP.NET app)
 10.2 client or later running on ANY platform
 Set ORA_DEBUG_JDWP in client environment
– SET ORA_DEBUG_JDWP=host=mymachine;port=4444
– Set in web app environment BEFORE connecting
 Start Listener
– Tools-> “Start Oracle External Application Debugger”
41
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
PL/SQL
Debugging
42
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Deployment

Run create scripts
 Run diff scripts – Schema Compare
 Plug Development PDB into Production CDB – Oracle Multitenant
43
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Using PDBs for Deployment
 Unplug from development/test
environment
 Plug into production environment
44
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Schema Compare Tool in Visual Studio
 New in Oracle Developer Tools for Visual Studio
– ODAC 12c
– Oracle Database 10.2 or higher
 Compare two schemas in the same or different dbs
– Visually inspect differences using UI
– Generate a diff script for deployment purposes
– Reverse schema compare to “rollback” changes
– Can compare down to granularity of schema type (eg compare
all tables, or all packages, etc)
45
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Schema Compare – View Differences
46
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Schema Compare
Typical Use Case of Visual Studio Developer
 Development schema identical to production schema
 Development schema evolves to meet needs of app
 Use Schema Compare to inspect what has changed
 Use Schema Compare to generate diff script
 Deploy diff script with app
47
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
D E M O N S T R A T I O N
Schema
Compare
48
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Upcoming .NET Sessions
Thursday Sept 26
 Hands-on Lab: Building .NET Applications with Oracle
– 11:00 AM - 1:30 PM, Marriott Marquis - Salon 3/4
 Oracle and .NET: Best Practices for Performance and
Deployment
– 2:00 PM - 3:00 PM, Marriott Marquis - Golden Gate C2
49
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Additional Oracle .NET Resources
 OTN .NET Developer Center
– http://otn.oracle.com/dotnet
 Twitter
– @OracleDOTNET
 YouTube
– http://www.youtube.com/user/OracleDOTNETTeam
 For more questions
– [email protected]
50
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Conclusion and Q & A
51
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
The preceding is intended to outline our general product direction. It is intended
for information purposes only, and may not be incorporated into any contract.
It is not a commitment to deliver any material, code, or functionality, and should
not be relied upon in making purchasing decisions. The development, release,
and timing of any features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
52
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
53
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
54
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement