Welcome to my blog!

Oracle Import Export

August 9, 2021 23:01

Oracle Import Export (edit)

Có 2 cách để làm việc với dòng lệnh trong Oracle như sau:

1) Open CMD với quyền Admin (sau đó paste câu lệnh imp username/password@localhost FILE=Northwind.dmp FULL=y vào để tiến hành import)
2) Open CMD với quyền Admin (sau đó paste câu lệnh sqlplus system/password@localhost/ORCL as sysdba vào để chạy các câu lệnh với SQL Plus)

Lưu ý: Phải start service OracleOraDB12Home1TNSListener của Oracle trước.

ORCL là alias name (net_service_name) trong tệp tnsnames.ora

2) Đường dẫn ORACLE_HOME:




Local Naming Parameters (tnsnames.ora) (oracle.com)

3) Lệnh cần nhớ:

sqlplus system/password as sysdba
sqlplus system/password@localhost/ORCL as sysdba
alter session set "_ORACLE_SCRIPT"=true;

4) Tham khảo:

Import, export file dmp Oracle database 11g (viblo.asia)

Import và Export cơ sở dữ liệu Oracle (openplanning.net)

Hướng dẫn sử dụng Oracle Database Link và Synonym (openplanning.net)

oracle11g - How to import an Oracle database from dmp file and log file? - Stack Overflow

20 Original Export and Import (oracle.com)

DROP TABLESPACE (oracle.com)

Dapper Extensions with Oracle database

June 18, 2021 21:28

Dapper Extensions with Oracle database (edit)

Advanced operations using Dapper.Net | InfoWorld

Dapper Extensions

Dapper + DapperExtensions + CodeGenerator easy to play SqlServer + MySql + Oracle + PostgreSql + Sqlite

GitHub - znyet/DapperExtensions: Dapper + DapperExtensions + CodeGenerator easy to play sqlserver、mysql、oracle、postgresql、sqlite

GitHub - tmsmith/Dapper-Extensions: Dapper Extensions is a small library that complements Dapper by adding basic CRUD operations (Get, Insert, Update, Delete) for your POCOs. For more advanced querying scenarios, Dapper Extensions provides a predicate system. The goal of this library is to keep your POCOs pure by not requiring any attributes or base class inheritance.

Dapper Extensions Alternatives - .NET ORM | LibHunt

A simple but effective mini-profiler for ASP.NET (and Core) websites

GitHub - MiniProfiler/dotnet: A simple but effective mini-profiler for ASP.NET (and Core) websites

NUnit 3 for VS 2019

NUnit 3 Test Adapter - Visual Studio Marketplace

Running Tests with the NUnit Visual Studio Adapter - Alteridem


Hello World Oracle

June 12, 2021 10:52

Hello World Oracle (edit)

Entity Framework 6 vs Oracle


EF6 CodeFisrt支持Oracle - Rick Carter - 博客园 (cnblogs.com)

Developing .NET Applications for Oracle Database (On-Premises)

Developing .NET Applications for Oracle Database (On-Premises) for .NET Core 3.1 or higher.

Build a .NET Application on the Oracle Database with Microsoft Visual Studio 2010

by John Paul Cook
Published June 2011

Build a .NET Application on the Oracle Database with Microsoft Visual Studio 2010

.NET Data Provider

Note: You can use Oracle.ManagedDataAccess NuGet package (.NET >= 4.0, database >= 10g Release 2).

ODP.NET, Unmanaged Driver: Oracle.DataAccess.Client.dll (for example namespace: Oracle.DataAccess.Types)

ODP.NET, Managed Driver: Oracle.ManagedDataAccess.dll (for example namespace: Oracle.ManagedDataAccess.Types)

Connection String

using Oracle.DataAccess.Client; // C#, ODP.NET Oracle managed provider

string oradb = "Data Source=OraDb;User Id=hr;Password=hr;";

string oradb = "Data Source=(DESCRIPTION=" + "(ADDRESS=(PROTOCOL=TCP)(HOST=ORASRVR)(PORT=1521))" + "(CONNECT_DATA=(SERVICE_NAME=ORCL)));" + "User Id=hr;Password=hr;";

OracleConnection conn = new OracleConnection(oradb);


string sql = " select department_name from departments where department_id = 10"; OracleCommand cmd = new OracleCommand(sql, conn); cmd.CommandType = CommandType.Text;

OracleDataReader dr = cmd.ExecuteReader(); dr.Read(); label1.Text = dr["department_name"].ToString(); // Retrieve by column name label1.Text = dr.GetString(0).ToString();  // Return a .NET data type label1.Text = dr.GetOracleString(0).ToString();  // Return an Oracle data type

label1.Text = dr.GetInt16("department_id").ToString();


catch (OracleException ex) // catches only Oracle errors {

Development Environment

OS: Windows Server 2016

Oracle Server Database: Oracle Database 12c Enterprise Edition Release - 64bit Production

Show me the code

SELECT banner FROM v$version WHERE ROWNUM = 1;

alter session set "_ORACLE_SCRIPT"=true;

create user Manh identified by Manh;

grant dba to MyDb;


 select sys_guid() from dual
 union all
 select sys_guid() from dual
 union all 
 select sys_guid() from dual

Oracle + Entity Framework Core

January 31, 2021 09:13

Entity Framework Core + Oracle (edit)

  1. Update Model from Database...
  2. Generate Database from Model...

Entity Framework, LINQ and Model-First for the Oracle Database


Entity Framework Core tools reference - .NET Core CLI


dotConnect for Oracle


Starting with an existing database


Oracle DB First


Oracle Command - Inserting Data in Run Time


To insert the first row into table dept you can use the following statement:

  1. CREATE TABLE dept:

    CREATE TABLE dept (
      deptno INT PRIMARY KEY,
      dname VARCHAR(14),
      loc VARCHAR(13)
  2. CREATE TABLE emp:

    CREATE TABLE emp (
      empno INT PRIMARY KEY,
      ename VARCHAR(10),
      job VARCHAR(9),
      mgr INT,
      hiredate DATE,
      sal FLOAT,
      comm FLOAT,
      deptno INT REFERENCES dept
INSERT INTO dept (deptno, dname, loc) VALUES (10,'Accounting','New York')

The following code fragment executes the query:

OracleConnection conn = new OracleConnection("User Id=scott;Password=tiger;Server=OraServer;");
OracleCommand cmd = new OracleCommand();
cmd.CommandText = "INSERT INTO dept (deptno, dname, loc) VALUES (10,'Accounting','New York')";
cmd.Connection = conn;
try {
  int aff = cmd.ExecuteNonQuery();
  MessageBox.Show(aff + " rows were affected.");
catch {
  MessageBox.Show("Error encountered during INSERT operation.");
finally {

Console Application - How You Can Create a .NET Core Application Using Entity Framework Core with Oracle


  1. Update Model From Database...
  2. Update Database from Model...
  3. Generate Database Script From Model...

Create a .NET Core Application Using Entity Framework Core with Oracle


October 21, 2020 13:45

Oracle (edit)

Oracle XE





Recent posts