Create connection with Oracle using New-AzDmsConnInfo - oracle

enter image description hereAs per article below we can create source connection with Oracle database , however when we put Oracle as a server type in New-AzDmsConnInfo it is giving errors. Could someone please guide me with the Powershell script to create DB connection with Oracle in Azure DMS.
https://learn.microsoft.com/en-us/azure/dms/howto-sql-server-to-azure-sql-powershell#create-a-database-connection-info-object-for-the-source-and-target-connections.
Thank you for your comments , please see below details of error :
While creating a new DMS project using below CMDlet it is successful. which is Source : oracle and destination : SQL DB .
New-AzDataMigrationProject -ResourceGroupName myResourceGroup -ServiceName $service.Name
-ProjectName MyDMSProject -Location EastUS
-SourceType Oracle -TargetType SQLDB
However while creating a new Source connection info using below command it is getting failed : it is given in the MS link that Source connection can also be made to Oracle using New-AzDMsConnInfo(link is given )
$sourceConnInfo = New-AzDmsConnInfo -ServerType Oracle-DataSource Oracle
-AuthType SqlAuthentication `
Error is as below :
PS C:\Windows\system32> $sourceConnInfo = New-AzDmsConnInfo -ServerType Oracle -DataSource DBNAME
-AuthType SqlAuthentication `
-TrustServerCertificate:$true
New-AzDataMigrationConnectionInfo : Cannot bind parameter 'ServerType'. Cannot convert value "Oracle" to type
"Microsoft.Azure.Commands.DataMigration.Models.ServerTypeEnum". Error: "Unable to match the identifier name Oracle to a valid
enumerator name. Specify one of the following enumerator names and try again:
SQL, MongoDb, SQLMI"
At line:1 char:49
$sourceConnInfo = New-AzDmsConnInfo -ServerType Oracle `
~~~~~~
CategoryInfo : InvalidArgument: (:) [New-AzDataMigrationConnectionInfo], ParameterBindingException
FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.DataMigration.Cmdlets.NewConnectionInfoCmdlet
Or please help me with the powershell script which can be used to create Oracle database connection in Azure DMS
-TrustServerCertificate:$true

Related

How to install JDBC driver on Databricks Cluster?

I'm trying to get the data from my Oracle Database to a Databricks Cluster. But I think I'm doing it wrong:
On the cluster library I just installed the ojdbc8.jar and then after that I opened a notebook and did this to connect:
CREATE TABLE oracle_table
USING org.apache.spark.sql.jdbc
OPTIONS (
dbtable 'table_name',
driver 'oracle.jdbc.driver.OracleDriver',
user 'username',
password 'pasword',
url 'jdbc:oracle:thin://#<hostname>:1521/<db>')
And it says:
java.sql.SQLException: Invalid Oracle URL specified
Can someone help? I've been reading documentations but there's no clear instruction on how I should actually install this jar step by step. I might be using the wrong jar? Thanks!
I have managed to set this up in Python/PySpark as follows:
jdbcUrl = "jdbc:oracle:thin:#//hostName:port/databaseName"
connectionProperties = {
"user" : username,
"password" : password,
"driver" : "oracle.jdbc.driver.OracleDriver"
}
query = "(select * from mySchema.myTable )"
df = spark.read.jdbc(url=jdbcUrl, table=query1, properties=connectionProperties)
I am using the Oracle JDBC Thin Driver instantclient-basic-linux.x64-21.5.0.0.0, as available on the Oracle webpages. The current version is 21.7 I think, but it should work the same way.
Check this link to understand the two different notations for jdbc URLs

WMI query generic failure when accessing MDM_VPNv2_01 class

I am trying to setup auto VPN on Windows 10 laptop and created a Powershell scripted as suggested in https://learn.microsoft.com/en-us/windows-server/remote/remote-access/vpn/always-on-vpn/deploy/vpn-deploy-client-vpn-connections. I am using the same script to setup the VPN.
The profile creation works fine, but when I run the script again, deletion of the profile fails. I debugged the problem and found out that EnumerateInstances on MDM_VPNv2_01 class in root\cimv2\mdm\dmmap namespace is failing. It fails with following error string - "A general error occurred that is not covered by a more specific error code..".
On doing some more exploration, I found out that I need to execute following WMI query to get the instances of MDM_VPNv2_01 class, that too returns a Generic Failure (Please note I have a VPN adapter created on the laptop when I executed this query):
PS C:\> Get-WmiObject -Namespace root\cimv2\mdm\dmmap -Class MDM_VPNv2_01
Get-WmiObject : Generic failure
At line:1 char:1
+ Get-WmiObject -Namespace root\cimv2\mdm\dmmap -Class MDM_VPNv2_01
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
I tried several options like running this query in WMI-explorer, recompiling the MOF for this particular provider etc., but nothing helped. I ran WMIDiag on my machine which gives following message for the MDM_VPNv2_01 class:
.9847 17:26:21 (3) 1 static instance(s) found for '__SystemSecurity' in 'ROOT/CIMV2/MDM/DMMAP'in 0 second(s).
.9848 17:26:21 (3) Retrieving static information (MOF) of 'MDM_VPNv2_01' (I=1).
.9849 17:26:21 (3) Qualifier information of 'MDM_VPNv2_01': Dynamic=True, Provider='DMWmiBridgeProv', Association=False.
.9850 17:26:21 (3) Dynamic 'MDM_VPNv2_01' class in 'ROOT/CIMV2/MDM/DMMAP' is supported by WMI provider 'DMWmiBridgeProv'.
.9851 17:26:21 (3) Skipping request of dynamic instances of 'MDM_VPNv2_01' in 'ROOT/CIMV2/MDM/DMMAP' because:
.9852 17:26:21 (3) - Request all dynamic instances is set to FALSE.
Please note that the same script works fine on other laptops. It is worth mentioning here that I am running this script with a local user account having administrator privileges.
I could not find any helpful information related to this problem on Internet. It would be really a great help if someone can suggest a possible solution for this problem.
I enabled WMI activity debug and observed following error log on running the query to get MDM_VPNv2_01 class instances:
Log Name: Microsoft-Windows-WMI-Activity/Debug
Source: Microsoft-Windows-WMI-Activity
Date: 20-09-2018 19:38:41
Event ID: 101
Task Category: None
Level: Error
Keywords:
User: INCT-ARUN\akoshal
Computer: INCT-Arun
Description:
ComponentName = WMI_ADAPTER; ErrorId = 0x1; ErrorDetail = WMIContext::PostResultToServer, provider completed the operation with context (00000211E4C517A0). Failed with MIRESULT (1).; FileName = onecore\admin\wmi\wmiv2\tools\adapter\wmicontext.cpp:945

Remove-TeamUser command from Powershell module for teams throwing an error

The following command throws an error while removing an owner from microsoft teams.
Remove-TeamUser -GroupId 7ad89f19-1c20-4f51-a520-1228002ac93d -User Megan.ryn.admin#xxx.onmicrosoft.com
ERROR:
Remove-TeamUser : Error occurred while executing Remove-TeamUser
Code: Request_ResourceNotFound
Message: Resource '7ad89f19-1c20-4f51-a520-1228002ac93d' does not exist or one of its queried reference-property
objects are not present.
InnerError:
RequestId: 7676f32b-2ed3-49fc-8013-69ea4a63b97b
DateTimeStamp: 2018-08-20T11:29:26
HttpStatusCode: Request_ResourceNotFound
At line:1 char:1
+ Remove-TeamUser -GroupId 7ad89f19-1c20-4f51-a520-1228002ac93d -User ...
+ CategoryInfo : NotSpecified: (:) [Remove-TeamUser], ApiException
+ FullyQualifiedErrorId : Microsoft.TeamsCmdlets.PowerShell.Custom.ErrorHandling.ApiException,Microsoft.TeamsCmdle ts.PowerShell.Custom.RemoveTeamUser
Strangely its the Teams GUID which the command reports as not being able to find. I can confirm further operations on adding new users to this team via powershell work fine
Some background
The team was provisioned via C# using Graph api. The user in question is the admin account under which the C# application was running.
I can confirm that the user Meganryn.admin has sufficient permissions
thanks
a
You need the user ID not the user try...
$megryn = get-teamuser -groupid 7ad89f19-1c20-4f51-a520-1228002ac93d | where-object{$_.Name -like "Megan.ryn.admin} | select -expandproperty userid
remove-teamuser -groupid 7ad89f19-1c20-4f51-a520-1228002ac93d -user $megryn

RobotFramework Oracle DB Connection Issue

I'm trying to check if the oracle DB connection using the Keyword:
Connect To Database Using Custom Params
Following libraries are imported:
Database Library
JayDeBe API
This this is the connection string used:
'oracle.jdbc.driver.OracleDriver', 'jdbc:oracle:thin:#//DBHostname:Port/DBName', ['user', 'pass']
We do not get any response that can identify if the connection is established or rejected.
We see this message in RIDE:
'oracle.jdbc.driver.OracleDriver', 'jdbc:oracle:thin:#//DBHostName:Port/DBName', ['user', 'pass']
20170927 17:07:54.438 : INFO : Executing : Connect To Database Using Custom Params : jaydebeapi.connect(db_api_2.connect('oracle.jdbc.driver.OracleDriver', 'jdbc:oracle:thin:#//DBHostName:Port/DBName', ['user', 'pass']))
Can someone please help us?
We found the solution: In our case we have python 2.7(32bit) therefore we need the following:
1. Oracle Instant Client Downloads for Microsoft Windows (32-bit). you can download it from here: http://www.oracle.com/technetwork/topics/winsoft-085727.html
Set the variable path in environment variable for the Oracle Instant client.
Download cx_Oracle API (32bit- cx_Oracle-6.0.2-cp27-cp27m-win32.whl (md5) ) from the location:https://pypi.python.org/pypi/cx_Oracle/
Open command prompt and run: pip install cx_Orcle --upgrade
Open the RIDE and use the following keyword:
Connect To Database Using Custom Params cx_Oracle 'user', 'password', 'DBHOSTNAME:PORT/DBNAME'

RobotFramework : cx_Oracle - FAIL : InternalError: No Oracle error?

Couldn't find a solution for my problem using search so I created this topic.
I'm having problems when connecting to Oracle database using DataBase libary and cx_Oracle module.
In python import cx_Oracle works great (returns no error), but when I try to connect to DB on RobotFramework with Connect To Database Using Custom Params | cx_Oracle | 'user', 'pass', 'host/db'
I get an error : FAIL : InternalError: No Oracle error?
If I try to connect to database using
Connect To Database | dbapiModuleName=cx_Oracle | dbName=db_name | dbUsername=user | dbPassword=pass | dbHost=host | dbPort=port
I get an error : FAIL : TypeError: 'database' is an invalid keyword argument for this function
I'm using Windows7 x86, non-Administrator user, Oracle 11g, Python 2.7.3, cx_Oracle 5.1.2, RobotFramework 2.7.6, RIDE 1.0.1. Everything else works like a charm (connection to database using PLSQLDeveloper, RobotFramework, Selenium2Libary etc.)
Have anyone any ideas how can I solve my problem?
Sincerely,
Kristiāns
I run into the same problem: 'FAIL : TypeError: 'database' is an invalid keyword argument for this function'
This is what works for me:
DatabaseLibrary.Connect To Database Using Custom Params | cx_Oracle | 'user', 'password', 'host:port/dbname'

Resources