Quantcast
Channel: Donghua's Blog - DBAGlobe
Viewing all 604 articles
Browse latest View live

Using WITH ENCRYPTION option obfuscates the definition of the procedure in T-SQL

$
0
0

CREATE PROCEDURE [dbo].[CustOrdersDetail_Encrypted] @OrderID int
WITH ENCRYPTION
AS
SELECT ProductName,
    UnitPrice=ROUND(Od.UnitPrice, 2),
    Quantity,
    Discount=CONVERT(int, Discount * 100),
    ExtendedPrice=ROUND(CONVERT(money, Quantity * (1 - Discount) * Od.UnitPrice), 2)
FROM Products P, [Order Details] Od
WHERE Od.ProductID = P.ProductID and Od.OrderID = @OrderID

Effects after encryption

 

image

 

image

image

image

image


Different XML output format for “XML RAW”, “XML AUTO” and “ELEMENTS”

$
0
0

select C.CustomerID,C.AccountNumber,Soh.SalesOrderID,Soh.OrderDate
from AdventureWorks2012.Sales.SalesOrderHeader Soh
inner join AdventureWorks2012.Sales.Customer C
on Soh.CustomerID=C.CustomerID
where C.CustomerID=29580
for XML RAW

<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="43665" OrderDate="2005-07-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="44284" OrderDate="2005-10-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="45043" OrderDate="2006-01-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="45782" OrderDate="2006-04-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="46611" OrderDate="2006-07-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="47666" OrderDate="2006-10-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="48757" OrderDate="2007-01-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="49826" OrderDate="2007-04-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="51089" OrderDate="2007-07-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="55241" OrderDate="2007-10-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="61182" OrderDate="2008-01-01T00:00:00" />
<row CustomerID="29580" AccountNumber="AW00029580" SalesOrderID="67266" OrderDate="2008-04-01T00:00:00" />

select C.CustomerID,C.AccountNumber,Soh.SalesOrderID,Soh.OrderDate
from AdventureWorks2012.Sales.SalesOrderHeader Soh
inner join AdventureWorks2012.Sales.Customer C
on Soh.CustomerID=C.CustomerID
where C.CustomerID=29580
for XML RAW ,ELEMENTS

<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>43665</SalesOrderID>
  <OrderDate>2005-07-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>44284</SalesOrderID>
  <OrderDate>2005-10-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>45043</SalesOrderID>
  <OrderDate>2006-01-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>45782</SalesOrderID>
  <OrderDate>2006-04-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>46611</SalesOrderID>
  <OrderDate>2006-07-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>47666</SalesOrderID>
  <OrderDate>2006-10-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>48757</SalesOrderID>
  <OrderDate>2007-01-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>49826</SalesOrderID>
  <OrderDate>2007-04-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>51089</SalesOrderID>
  <OrderDate>2007-07-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>55241</SalesOrderID>
  <OrderDate>2007-10-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>61182</SalesOrderID>
  <OrderDate>2008-01-01T00:00:00</OrderDate>
</row>
<row>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <SalesOrderID>67266</SalesOrderID>
  <OrderDate>2008-04-01T00:00:00</OrderDate>
</row>

select C.CustomerID,C.AccountNumber,Soh.SalesOrderID,Soh.OrderDate
from AdventureWorks2012.Sales.SalesOrderHeader Soh
inner join AdventureWorks2012.Sales.Customer C
on Soh.CustomerID=C.CustomerID
where C.CustomerID=29580
for XML AUTO

<C CustomerID="29580" AccountNumber="AW00029580">
  <Soh SalesOrderID="43665" OrderDate="2005-07-01T00:00:00" />
  <Soh SalesOrderID="44284" OrderDate="2005-10-01T00:00:00" />
  <Soh SalesOrderID="45043" OrderDate="2006-01-01T00:00:00" />
  <Soh SalesOrderID="45782" OrderDate="2006-04-01T00:00:00" />
  <Soh SalesOrderID="46611" OrderDate="2006-07-01T00:00:00" />
  <Soh SalesOrderID="47666" OrderDate="2006-10-01T00:00:00" />
  <Soh SalesOrderID="48757" OrderDate="2007-01-01T00:00:00" />
  <Soh SalesOrderID="49826" OrderDate="2007-04-01T00:00:00" />
  <Soh SalesOrderID="51089" OrderDate="2007-07-01T00:00:00" />
  <Soh SalesOrderID="55241" OrderDate="2007-10-01T00:00:00" />
  <Soh SalesOrderID="61182" OrderDate="2008-01-01T00:00:00" />
  <Soh SalesOrderID="67266" OrderDate="2008-04-01T00:00:00" />
</C>

select C.CustomerID,C.AccountNumber,Soh.SalesOrderID,Soh.OrderDate
from AdventureWorks2012.Sales.SalesOrderHeader Soh
inner join AdventureWorks2012.Sales.Customer C
on Soh.CustomerID=C.CustomerID
where C.CustomerID=29580
for XML AUTO ,ELEMENTS

<C>
  <CustomerID>29580</CustomerID>
  <AccountNumber>AW00029580</AccountNumber>
  <Soh>
    <SalesOrderID>43665</SalesOrderID>
    <OrderDate>2005-07-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>44284</SalesOrderID>
    <OrderDate>2005-10-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>45043</SalesOrderID>
    <OrderDate>2006-01-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>45782</SalesOrderID>
    <OrderDate>2006-04-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>46611</SalesOrderID>
    <OrderDate>2006-07-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>47666</SalesOrderID>
    <OrderDate>2006-10-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>48757</SalesOrderID>
    <OrderDate>2007-01-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>49826</SalesOrderID>
    <OrderDate>2007-04-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>51089</SalesOrderID>
    <OrderDate>2007-07-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>55241</SalesOrderID>
    <OrderDate>2007-10-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>61182</SalesOrderID>
    <OrderDate>2008-01-01T00:00:00</OrderDate>
  </Soh>
  <Soh>
    <SalesOrderID>67266</SalesOrderID>
    <OrderDate>2008-04-01T00:00:00</OrderDate>
  </Soh>
</C>

Created Indexed View in T-SQL

$
0
0

Wrong Example:

create view Employees_View as select * from [dbo].[Employees]
GO
create index Employees_View_Idx on Employees_View(LastName,First_name);
GO

What’s are possible errors for above 2 T-SQL Statements


Msg 1939, Level 16, State 1, Line 5
Cannot create index on view 'Employees_View' because the view is not schema bound.


Msg 1054, Level 15, State 6, Procedure Employees_View, Line 13
Syntax '*' is not allowed in schema-bound objects.


Msg 1940, Level 16, State 1, Line 36
Cannot create index on view 'Employees_View'. It does not have a unique clustered index.


Msg 1942, Level 16, State 1, Line 38
Cannot create index on view 'NORTHWND2.dbo.Employees_View'. It contains text, ntext, image, FILESTREAM or xml columns.

Correct Example:


drop view Employees_View
GO
create view Employees_View with schemabinding
as select [EmployeeID]
      ,[LastName]
      ,[FirstName]
      ,[Title]
      ,[TitleOfCourtesy]
      ,[BirthDate]
      ,[HireDate]
      ,[Address]
      ,[City]
      ,[Region]
      ,[PostalCode]
      ,[Country]
      ,[HomePhone]
      ,[Extension]
      ,[ReportsTo]
      ,[PhotoPath] from [dbo].[Employees]
GO

create unique clustered index Employees_View_Idx on Employees_View(LastName,Firstname);
GO

Explain Lead/Lag with simple example

$
0
0

select RegionID,RegionDescription,
lag(RegionDescription,1,0) over(order by RegionID) proceding_row,
lead(RegionDescription,1,0) over(order by RegionID) following_row
from [dbo].[Region]

image

Differences between snapshot isolation and read committed isolation using row versioning

$
0
0

https://technet.microsoft.com/en-us/library/ms189050(v=sql.105).aspx

 

Property

Read-committed isolation level using row versioning

Snapshot isolation level

The database option that must be set to ON to enable the required support.

READ_COMMITTED_SNAPSHOT

ALLOW_SNAPSHOT_ISOLATION

How a session requests the specific type of row versioning.

Use the default read-committed isolation level, or run the SET TRANSACTION ISOLATION LEVEL statement to specify the READ COMMITTED isolation level. This can be done after the transaction starts.

Requires the execution of SET TRANSACTION ISOLATION LEVEL to specify the SNAPSHOT isolation level before the start of the transaction.

The version of data read by statements.

All data that was committed before the start of each statement.

All data that was committed before the start of each transaction.

How updates are handled.

Reverts from row versions to actual data to select rows to update and uses update locks on the data rows selected. Acquires exclusive locks on actual data rows to be modified. No update conflict detection.

Uses row versions to select rows to update. Tries to acquire an exclusive lock on the actual data row to be modified, and if the data has been modified by another transaction, an update conflict occurs and the snapshot transaction is terminated.

Update conflict detection.

None.

Integrated support. Cannot be disabled.

Windows Server 2012 R2 prevent automatic logoff due to inactivity

$
0
0

Unlocked the missing Power Settings feature in Server 2012.

  1. Open the following registry key -HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7

  2. Set the following value - Attributes => 2

  3. Now open Control Panel>Power Options>Change Plan Settings>Change Advanced Power Settings
    a. The new Display section Console lock display off timeout is now available.
    b. Configure your “Plugged in” value accordingly (0 to disable)

  4. Set timeout to 0 to turn it off.

enter image description here

Configure Windows 2012 Server network to join domain using netsh scripting

$
0
0

C:\Users\Administrator>netsh interface ip show config

Configuration for interface "Ethernet0"
    DHCP enabled:                         Yes
    IP Address:                           192.168.229.134
    Subnet Prefix:                        192.168.229.0/24 (mask 255.255.255.0)
    Default Gateway:                      192.168.229.2
    Gateway Metric:                       0
    InterfaceMetric:                      10
    DNS servers configured through DHCP:  192.168.229.2
    Register with which suffix:           Primary only
    WINS servers configured through DHCP: 192.168.229.2

Configuration for interface "Loopback Pseudo-Interface 1"
    DHCP enabled:                         No
    IP Address:                           127.0.0.1
    Subnet Prefix:                        127.0.0.0/8 (mask 255.0.0.0)
    InterfaceMetric:                      50
    Statically Configured DNS Servers:    None
    Register with which suffix:           Primary only
    Statically Configured WINS Servers:   None

C:\Users\Administrator>netsh interface ipv4 set address "Ethernet0" static 192.168.229.210 255.255.255.0 192.168.229.200 1


C:\Users\Administrator>netsh interface ipv4 set dnsserver "Ethernet0" static 192.168.229.200 primary


C:\Users\Administrator>netsh interface ip show config

Configuration for interface "Ethernet0"
    DHCP enabled:                         No
    IP Address:                           192.168.229.210
    Subnet Prefix:                        192.168.229.0/24 (mask 255.255.255.0)
    Default Gateway:                      192.168.229.200
    Gateway Metric:                       1
    InterfaceMetric:                      10
    Statically Configured DNS Servers:    192.168.229.200
    Register with which suffix:           Primary only
    Statically Configured WINS Servers:   None

Configuration for interface "Loopback Pseudo-Interface 1"
    DHCP enabled:                         No
    IP Address:                           127.0.0.1
    Subnet Prefix:                        127.0.0.0/8 (mask 255.0.0.0)
    InterfaceMetric:                      50
    Statically Configured DNS Servers:    None
    Register with which suffix:           Primary only
    Statically Configured WINS Servers:   None

C:\Users\Administrator>netdom renamecomputer %computername% /newname:VMMSQL03
This operation will rename the computer WIN-7FVEEOP8PPF
to VMMSQL03.

Certain services, such as the Certificate Authority, rely on a fixed machine
name. If any services of this type are running on WIN-7FVEEOP8PPF,
then a computer name change would have an adverse impact.

Do you want to proceed (Y or N)?
y
The computer needs to be restarted in order to complete the operation.

The command completed successfully.


C:\Users\Administrator>shutdown /r /t 0

C:\Users\Administrator>netdom join VMMSQL03 /domain:dbaglobe.com /ud:dbaglobe\administrator /pd:*
Type the password associated with the domain user:

The computer needs to be restarted in order to complete the operation.

The command completed successfully.

C:\Users\Administrator>shutdown /r /t 0 /f

Troubleshooting SQL Server mirroring message

$
0
0
Symptom:

Error: 1443, Severity: 16, State: 2.
Database mirroring connection error 4 'An error occurred while receiving data: '10054(An existing connection was forcibly closed by the remote host.)'.' for 'TCP://vmmdb01:5023'.

Database Mirroring login attempt by user 'NT Service\MSSQL$PROD.' failed with error: 'Connection handshake failed. The login 'NT Service\MSSQL$PROD' does not have CONNECT permission on the endpoint. State 84.'.  [CLIENT: 2001:0:5ef5:79fb:2839:2416:f5ff:fdf0]

How to fix: 

Grant permission to all remote SQL instance connecting users to current instance DB Mirror End point

USE [master]
GO
CREATE LOGIN [NT SERVICE\MSSQL$PROD] FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO

GRANT CONNECT ON ENDPOINT::[Mirroring] TO [NT SERVICE\MSSQL$PROD2]; 

How to verify:

SELECT e.name as mirror_endpoint_name, s.name AS login_name
, p.permission_name, p.state_desc as permission_state, e.state_desc endpoint_state
FROM sys.server_permissions p
INNER JOIN sys.endpoints e ON p.major_id = e.endpoint_id
INNER JOIN sys.server_principals s ON p.grantee_principal_id = s.principal_id
WHERE p.class_desc = 'ENDPOINT' AND e.type_desc = 'DATABASE_MIRRORING'



Useful WMIC Queries

$
0
0
To execute these queries, run “WMIC” at a command prompt, followed by one of the following alias/es:
baseboard
get Manufacturer, Model, Name, PartNumber, slotlayout, serialnumber, poweredon
bios
get name, version, serialnumber
bootconfig
get BootDirectory, Caption, TempDirectory, Lastdrive
cdrom
get Name, Drive, Volumename
computersystem
get Name, domain, Manufacturer, Model, NumberofProcessors, PrimaryOwnerName,Username, Roles, totalphysicalmemory /format:list
cpu
get Name, Caption, MaxClockSpeed, DeviceID, status
datafile
where name='c:\\boot.ini' get Archive, FileSize, FileType, InstallDate, Readable, Writeable, System, Version
dcomapp
get Name, AppID /format:list
desktop
get Name, ScreenSaverExecutable, ScreenSaverActive, Wallpaper /format:list
desktopmonitor
get screenheight, screenwidth
diskdrive
get Name, Manufacturer, Model, InterfaceType, MediaLoaded, MediaType
diskquota
get User, Warninglimit, DiskSpaceUsed, QuotaVolume
environment
get Description, VariableValue
fsdir
where name='c:\\windows' get Archive, CreationDate, LastModified, Readable, Writeable, System, Hidden, Status
group
get Caption, InstallDate, LocalAccount, Domain, SID, Status
idecontroller
get Name, Manufacturer, DeviceID, Status
irq
get Name, Status
job
get Name, Owner, DaysOfMonth, DaysOfWeek, ElapsedTime, JobStatus, StartTime, Status
loadorder
get Name, DriverEnabled, GroupOrder, Status
logicaldisk
get Name, Compressed, Description, DriveType, FileSystem, FreeSpace, SupportsDiskQuotas, VolumeDirty, VolumeName
memcache
get Name, BlockSize, Purpose, MaxCacheSize, Status
memlogical
get AvailableVirtualMemory, TotalPageFileSpace, TotalPhysicalMemory, TotalVirtualMemory
memphysical
get Manufacturer, Model, SerialNumber, MaxCapacity, MemoryDevices
netclient
get Caption, Name, Manufacturer, Status
netlogin
get Name, Fullname, ScriptPath, Profile, UserID, NumberOfLogons, PasswordAge, LogonServer, HomeDirectory, PrimaryGroupID
netprotocol
get Caption, Description, GuaranteesSequencing, SupportsBroadcasting, SupportsEncryption, Status
netuse
get Caption, DisplayType, LocalName, Name, ProviderName, Status
nic
get AdapterType, AutoSense, Name, Installed, MACAddress, PNPDeviceID,PowerManagementSupported, Speed, StatusInfo
nicconfig
get MACAddress, DefaultIPGateway, IPAddress, IPSubnet, DNSHostName, DNSDomain
nicconfig
get MACAddress, IPAddress, DHCPEnabled, DHCPLeaseExpires, DHCPLeaseObtained, DHCPServer
nicconfig
get MACAddress, IPAddress, DNSHostName, DNSDomain, DNSDomainSuffixSearchOrder, DNSEnabledForWINSResolution, DNSServerSearchOrder
nicconfig
get MACAddress, IPAddress, WINSPrimaryServer, WINSSecondaryServer, WINSEnableLMHostsLookup, WINSHostLookupFile
ntdomain
get Caption, ClientSiteName, DomainControllerAddress, DomainControllerName, Roles, Status
ntevent
where (LogFile='system' and SourceName='W32Time') get Message, TimeGenerated
ntevent
where (LogFile='system' and SourceName='W32Time' and Message like '%timesource%') get Message, TimeGenerated
ntevent
where (LogFile='system' and SourceName='W32Time' and EventCode!='29') get TimeGenerated, EventCode, Message
onboarddevice
get Description, DeviceType, Enabled, Status
os
get Version, Caption, CountryCode, CSName, Description, InstallDate, SerialNumber, ServicePackMajorVersion, WindowsDirectory /format:list
os
get CurrentTimeZone, FreePhysicalMemory, FreeVirtualMemory, LastBootUpTime, NumberofProcesses, NumberofUsers, Organization, RegisteredUser, Status
pagefile
get Caption, CurrentUsage, Status, TempPageFile
pagefileset
get Name, InitialSize, MaximumSize
partition
get Caption, Size, PrimaryPartition, Status, Type
printer
get DeviceID, DriverName, Hidden, Name, PortName, PowerManagementSupported, PrintJobDataType, VerticalResolution, Horizontalresolution
printjob
get Description, Document, ElapsedTime, HostPrintQueue, JobID, JobStatus, Name, Notify, Owner, TimeSubmitted, TotalPages
process
get Caption, CommandLine, Handle, HandleCount, PageFaults, PageFileUsage, PArentProcessId, ProcessId, ThreadCount
product
get Description, InstallDate, Name, Vendor, Version
qfe
get description, FixComments, HotFixID, InstalledBy, InstalledOn, ServicePackInEffect
quotasetting
get Caption, DefaultLimit, Description, DefaultWarningLimit, SettingID, State
recoveros
get AutoReboot, DebugFilePath, WriteDebugInfo, WriteToSystemLog
Registry
get CurrentSize, MaximumSize, ProposedSize, Status
scsicontroller
get Caption, DeviceID, Manufacturer, PNPDeviceID
server
get ErrorsAccessPermissions, ErrorsGrantedAccess, ErrorsLogon, ErrorsSystem, FilesOpen, FileDirectorySearches
service
get Name, Caption, State, ServiceType, StartMode, pathname
share
get name, path, status
sounddev
get Caption, DeviceID, PNPDeviceID, Manufacturer, status
startup
get Caption, Location, Command
sysaccount
get Caption, Domain, Name, SID, SIDType, Status
sysdriver
get Caption, Name, PathName, ServiceType, State, Status
systemenclosure
get Caption, Height, Depth, Manufacturer, Model, SMBIOSAssetTag, AudibleAlarm, SecurityStatus, SecurityBreach, PoweredOn, NumberOfPowerCords
systemslot
get Number, SlotDesignation, Status, SupportsHotPlug, Version, CurrentUsage, ConnectorPinout
tapedrive
get Name, Capabilities, Compression, Description, MediaType, NeedsCleaning, Status, StatusInfo
timezone
get Caption, Bias, DaylightBias, DaylightName, StandardName
useraccount
get AccountType, Description, Domain, Disabled, LocalAccount, Lockout, PasswordChangeable, PasswordExpires, PasswordRequired, SID
memorychip
get BankLabel, Capacity, Caption, CreationClassName, DataWidth, Description, Devicelocator, FormFactor, HotSwappable, InstallDate, InterleaveDataDepth, InterleavePosition, Manufacturer, MemoryType, Model, Name, OtherIdentifyingInfo, PartNumber, PositionInRow, PoweredOn, Removable, Replaceable, SerialNumber, SKU, Speed, Status, Tag, TotalWidth, TypeDetail, Version



Example: 
C:\Users\donghua>wmic /output:c:\test3.txt useraccount list brief /format:table

Data export/import is the only way in Oracle 12c to change the characterset from AL32UTF8 to WE8ISO8859P1

$
0
0

SQL>  select property_value from database_properties where property_name='NLS_CHARACTERSET';

PROPERTY_VALUE
--------------------------------------------------------------------------------
AL32UTF8


SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';

VALUE
--------------------------------------------------------------------------------
AL32UTF8


SQL> alter database character set INTERNAL_CONVERT WE8ISO8859P1;
alter database character set INTERNAL_CONVERT WE8ISO8859P1
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set

Configure ODBC Data Source for Oracle Client

$
0
0

 

Most easiest: Using EZConnect:

image

Standard: Using TNSNAMES.ORA:

image

Rename Windows Server name from “WIN-QITD52CONSC” to “VMWDB02”

$
0
0


PS C:\> sqlcmd -S VMWDB02\PROD1 –W


1> select @@servername
2> GO

-
WIN-QITD52CONSC\PROD1

(1 rows affected)


1> select serverproperty('servername')
2> GO

-
VMWDB02\PROD1

(1 rows affected)


1> sp_dropserver 'WIN-QITD52CONSC\PROD1'
2> GO


1> sp_addserver 'VMWDB02\PROD1',local
2> go


1> exit

 

Followed by a restart of SQL Service

https://msdn.microsoft.com/en-us/library/ms345235.aspx

Disable firewall on Redhat EL7 (OL7)

$
0
0
[root@mysql01 ~]# systemctl stop firewalld.service
[root@mysql01 ~]# systemctl disable firewalld.servicerm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'



[root@mysql01 ~]# iptables -LChain INPUT (policy ACCEPT)
target     prot opt source               destination


Chain FORWARD (policy ACCEPT)
target     prot opt source               destination


Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination




[root@mysql01 ~]# systemctl status firewalld.servicefirewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active: inactive (dead)


May 30 19:22:38 mysql01.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
May 30 19:22:42 mysql01.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
May 30 19:24:55 mysql01.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
May 30 19:24:56 mysql01.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
May 30 19:25:14 mysql01.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.

Sample Static IP configuration in OL7 RHEL7

$
0
0
[root@mysql01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777728
TYPE=Ethernet
BOOTPROTO=static
NAME=eno16777728
ONBOOT=yes
IPADDR=192.168.6.51
NETMASK=255.255.255.0
GATEWAY=192.168.6.2
DNS1=192.168.6.2
DNS2=8.8.8.8
DOMAIN=localdomain

FATAL ERROR: please install the following Perl modules before executing scripts/mysql_install_db: Data::Dumper

$
0
0
[mysql@mysql01 mysqlc]$ scripts/mysql_install_db --no-defaults --datadir=/mysql/my_cluster/mysqld_data/
FATAL ERROR: please install the following Perl modules before executing scripts/mysql_install_db:
Data::Dumper


[root@mysql01 ~]# yum install perl-Data-Dumper.x86_64
Resolving Dependencies
--> Running transaction check
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
=======================================================================================================================================================
 Package                                  Arch                           Version                              Repository                          Size
=======================================================================================================================================================
Installing:
 perl-Data-Dumper                         x86_64                         2.145-3.el7                          ol7_latest                          47 k

Transaction Summary
=======================================================================================================================================================
Install  1 Package

Total download size: 47 k
Installed size: 97 k
Is this ok [y/d/N]: y
Downloading packages:
perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                                         |  47 kB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                 1/1
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                 1/1

Installed:
  perl-Data-Dumper.x86_64 0:2.145-3.el7

Complete!

MySQL Cluster Quick Start Guide – LINUX

$
0
0
 


Perform Following Changes on all 3 servers


[root@mysql01 ~]# cat /etc/hosts
192.168.6.51    mysql01
192.168.6.52    mysql02
192.168.6.53    mysql03
 
[mysql@mysql01 repo]$ id -a mysql
uid=200(mysql) gid=200(mysql) groups=200(mysql)
 
[mysql@mysql01 ~]$ cat ~/.bash_profile
export MYSQL_HOME=/mysql/mysqlc
export PATH=$MYSQL_HOME/bin:$PATH
 
 
[mysql@mysql01 repo]$ unzip "MySQL Cluster 7.4.6 TAR for Generic Linux (glibc2.5) x86 (64bit).zip"
[mysql@mysql01 repo]$ tar zxvf mysql-cluster-advanced-7.4.6-linux-glibc2.5-x86_64.tar.gz
 
[mysql@mysql01 repo]$ mv mysql-cluster-advanced-7.4.6-linux-glibc2.5-x86_64 /mysql/
[mysql@mysql01 repo]$ ln -s /mysql/mysql-cluster-advanced-7.4.6-linux-glibc2.5-x86_64 /mysql/mysqlc
[mysql@mysql01 repo]$ mkdir /mysql/my_cluster/mysqld_data
[mysql@mysql01 repo]$ mkdir /mysql/my_cluster/ndb_data
 
 
[mysql@mysql01 repo]$ cat /mysql/my_cluster/my.cnf
[mysqld]
ndbcluster
datadir=/mysql/my_cluster/mysqld_data
basedir=/mysql/mysqlc
port=5000
ndb-mgmd-host=mysql03:1186
 
 
[mysql@mysql01 repo]$ cat /mysql/my_cluster/config.ini
[ndb_mgmd]
hostname=mysql03
datadir=/mysql/my_cluster/ndb_data
NodeId=1
 
[ndbd default]
noofreplicas=2
datadir=/mysql/my_cluster/ndb_data
 
[ndbd]
hostname=mysql01
NodeId=11
 
[ndbd]
hostname=mysql02
NodeId=12
 
[mysqld]
hostname=mysql01
NodeId=21
 
[mysqld]
hostname=mysql02
NodeId=22

 

Perform following changes in the order of commands executions


[mysql@mysql01 mysqlc]$ cd /mysql/mysqlc
[mysql@mysql01 mysqlc]$ scripts/mysql_install_db --no-defaults --datadir=/mysql/my_cluster/mysqld_data/
[mysql@mysql02 mysqlc]$ cd /mysql/mysqlc
[mysql@mysql02 mysqlc]$ scripts/mysql_install_db --no-defaults --datadir=/mysql/my_cluster/mysqld_data/
 
[mysql@mysql03 ~]$ /mysql/mysqlc/bin/ndb_mgmd -f /mysql/my_cluster/config.ini --initial --configdir=/mysql/my_cluster/
 
[mysql@mysql01 ~]$ /mysql/mysqlc/bin/ndbd -c mysql03:1186
 
[mysql@mysql02 ~]$ /mysql/mysqlc/bin/ndbd -c mysql03:1186
 
[mysql@mysql01 ~]$ /mysql/mysqlc/bin/mysqld --defaults-file=/mysql/my_cluster/my.cnf &
[mysql@mysql02 ~]$ /mysql/mysqlc/bin/mysqld --defaults-file=/mysql/my_cluster/my.cnf &
 
[mysql@mysql03 ~]$ /mysql/mysqlc/bin/ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=11   @192.168.6.51  (mysql-5.6.24 ndb-7.4.6, Nodegroup: 0, *)
id=12   @192.168.6.52  (mysql-5.6.24 ndb-7.4.6, Nodegroup: 0)
 
[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.6.53  (mysql-5.6.24 ndb-7.4.6)
 
[mysqld(API)]   2 node(s)
id=21   @192.168.6.51  (mysql-5.6.24 ndb-7.4.6)
id=22   @192.168.6.52  (mysql-5.6.24 ndb-7.4.6)

 

Perform testing


[mysql@mysql01 ~]$ /mysql/mysqlc/bin/mysql -h localhost -P 5000 -u root
mysql> create user root@'mysql%' identified by 'P@ssw0rd';
mysql> grant all privileges on *.* to root@'mysql%';
 
[mysql@mysql02 ~]$ /mysql/mysqlc/bin/mysql -h localhost -P 5000 -u root
mysql> create user root@'mysql%' identified by 'P@ssw0rd';
mysql> grant all privileges on *.* to root@'mysql%';
 
[mysql@mysql03 ~]$ /mysql/mysqlc/bin/mysql -h mysql01 -P 5000 -u root -p
Enter password:
mysql> select user();
+--------------+
| user()       |
+--------------+
| root@mysql03 |
+--------------+
1 row in set (0.00 sec)
 
mysql>  create database clusterdb;
Query OK, 1 row affected (0.08 sec)
 
mysql> use clusterdb;
Database changed
 
mysql> create table simples (id int not null primary key) engine=ndb;
Query OK, 0 rows affected (0.20 sec)
 
mysql> insert into simples values (1),(2),(3),(4);
Query OK, 4 rows affected (0.01 sec)
Records: 4  Duplicates: 0  Warnings: 0
 
mysql>  select * from simples;
+----+
| id |
+----+
|  3 |
|  1 |
|  2 |
|  4 |
+----+
4 rows in set (0.00 sec)
 
mysql> quit
Bye
 
[mysql@mysql03 ~]$ /mysql/mysqlc/bin/mysql -h mysql02 -P 5000 -u root -p
Enter password:
 
mysql> use clusterdb;
Database changed
 
mysql> select * from simples;
+----+
| id |
+----+
|  1 |
|  2 |
|  4 |
|  3 |
+----+
4 rows in set (0.01 sec)
 
mysql> quit
Bye

 

Shutdown


[mysql@mysql03 ~]$ /mysql/mysqlc/bin/mysqladmin -h mysql01 -P 5000 -u root -pP@ssw0rd shutdown
[mysql@mysql03 ~]$ /mysql/mysqlc/bin/mysqladmin -h mysql02 -P 5000 -u root -pP@ssw0rd shutdown
 [mysql@mysql03 ~]$ /mysql/mysqlc/bin/ndb_mgm -e shutdown
Connected to Management Server at: localhost:1186
3 NDB Cluster node(s) have shutdown.
Disconnecting to allow management server to shutdown.

 


 

Install MySQL Enterprise Monitor Server & Agent

$
0
0

[root@mysql03 repo]# ./mysqlmonitor-3.0.21.3149-linux-x86_64-installer.bin
Language Selection
 
Please select the installation language
[1] English - English
[2] Japanese - 日本語
Please choose an option [1] :
Info: During the installation process you will be asked to enter usernames and
passwords for various pieces of the Enterprise Monitor. Please be sure to make
note of these in a secure location so you can recover them in case they are
forgotten.
Press [Enter] to continue :
----------------------------------------------------------------------------
Welcome to the setup wizard for the MySQL Enterprise Monitor
 
----------------------------------------------------------------------------
Please specify the directory where the MySQL Enterprise Monitor will be
installed
 
Installation directory [/opt/mysql/enterprise/monitor]:
 
----------------------------------------------------------------------------
Select Requirements
 
Select Requirements
 
Please indicate the scope of monitoring this installation will initially encompass so we can configure Tomcat and MySQL memory usage accordingly. The manual contains instructions for updating the configuration later, if needed. This installation will monitor a:
 
System Size
 
[1] Small system: No more than 5 to 10 MySQL Servers monitored from a laptop computer or low-end server with no more than 4 GB of RAM
[2] Medium system: Up to 100 MySQL Servers monitored from a medium-size but shared server with 4 GB to 8 GB of RAM
[3] Large system: More than 100 MySQL Servers monitored from a high-end server dedicated to MEM with more than 8 GB RAM
Please choose an option [2] : 1
 
----------------------------------------------------------------------------
Tomcat Server Options
 
Please specify the following parameters for the bundled Tomcat Server
 
Tomcat Server Port [18080]:
 
Tomcat SSL Port [18443]:
 
----------------------------------------------------------------------------
Service Manager User Account
 
You are installing as root, but it's not good practice for the Service Manager
to run under the root user account.  Please specify the name of a user account
to use for the Service Manager below.  Note that this user account will be
created for you if it doesn't already exist.
 
User Account [mysqlmem]:
 
----------------------------------------------------------------------------
Database Installation
 
Please select which database configuration you wish to use
 
[1] I wish to use the bundled MySQL database
[2] I wish to use an existing MySQL database *
Please choose an option [1] :
 
* We will validate the version of your existing MySQL database server during the
installation. See documentation for minimum version requirements.
 
Important: MySQL Enterprise Monitor 2.3 and 3.0 cannot share a Repository. If
you're not using the bundled Repository and will be running both versions in
your environment, you must set up and maintain separate repositories for them.
 
 
 
Visit the following URL for more information:
 
http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-install-server.html
 
----------------------------------------------------------------------------
Repository Configuration
 
Please specify the following parameters for the bundled MySQL server
 
Repository Username [service_manager]:
 
Password :
Re-enter :
MySQL Database Port [13306]:
 
MySQL Database Name [mem]:
 
 
 
Use SSL when connecting to the database [y/N]:
 
 
----------------------------------------------------------------------------
Setup is now ready to install MySQL Enterprise Monitor on your computer.
 
Do you want to continue? [Y/n]: y
 
----------------------------------------------------------------------------
Please wait while Setup installs MySQL Enterprise Monitor on your computer.
 
 Installing
 0% ______________ 50% ______________ 100%
 #########################################
 
----------------------------------------------------------------------------
Completed installing files
 
 
 
Setup has completed installing the MySQL Enterprise Monitor files on your
computer
 
Uninstalling the MySQL Enterprise Monitor files can be done by invoking:
/opt/mysql/enterprise/monitor/uninstall
 
To complete the installation, launch the MySQL Enterprise Monitor UI and
complete the initial setup. Refer to the readme file for additional information
and a list of known issues.
 
 
Press [Enter] to continue :
 
----------------------------------------------------------------------------
Completed installing files
 
WARNING: To improve security, all communication with the Service Manager uses
SSL. Because only a basic self-signed security certificate is included when the
Service Manager is installed, it is likely that your browser will display a
warning about an untrusted connection. Please either install your own
certificate or add a security exception for the Service Manager URL to your
browser. See the documentation for more information.
 
http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-install-server.html
Press [Enter] to continue :
 
----------------------------------------------------------------------------
Setup has finished installing MySQL Enterprise Monitor on your computer.
 
View Readme File [Y/n]: n
 
Info: To configure the MySQL Enterprise Monitor please visit the following page:
https://localhost:18443
Press [Enter] to continue :

 


[mysql@mysql01 repo]$ ./mysqlmonitoragent-3.0.21.3149-linux-x86-64bit-installer.bin
Language Selection
 
Please select the installation language
[1] English - English
[2] Japanese - 日本語
Please choose an option [1] :
----------------------------------------------------------------------------
Welcome to the MySQL Enterprise Monitor Agent Setup Wizard.
 
----------------------------------------------------------------------------
Installation directory
 
 
Please specify the directory where MySQL Enterprise Monitor Agent will be
installed
 
 
Installation directory [/mysql/mysql/enterprise/agent]:
 
 
How will the agent connect to the database it is monitoring?
 
 
[1] TCP/IP
[2] Socket
Please choose an option [1] :
 
----------------------------------------------------------------------------
Monitoring Options
 
You can configure the Agent to monitor this host (file systems, CPU, RAM, etc.)
and then use the Monitor UI to furnish connection parameters for all current and
future running MySQL Instances. This can be automated or done manually for each
MySQL Instance discovered by the Agent. (Note: scanning for running MySQL
processes is not available on Windows, but you can manually add new connections
and parameters from the Monitor UI as well.)
 
Visit the following URL for more information:
http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-qanal-using-feeding.html
 
Monitoring options:
 
[1] Host only: Configure the Agent to monitor this host and then use the Monitor UI to furnish connection parameters for current and future running MySQL Instances.
[2] Host and database: Configure the Agent to monitor this host and furnish connection parameters for a specific MySQL Instance now. This process may be scripted. Once installed, this Agent will also continuously look for new MySQL Instances to monitor as described above.
Please choose an option [2] : 1
 
----------------------------------------------------------------------------
Setup is now ready to begin installing MySQL Enterprise Monitor Agent on your
computer.
 
Do you want to continue? [Y/n]:
 
----------------------------------------------------------------------------
Please wait while Setup installs MySQL Enterprise Monitor Agent on your
computer.
 
 Installing
 0% ______________ 50% ______________ 100%
 #########################################
 
----------------------------------------------------------------------------
MySQL Enterprise Monitor Options
 
Hostname or IP address []: mysql03
 
Tomcat SSL Port [18443]:
 
The following are the username and password that the Agent will use to connect
to the Monitor.  They were defined when you installed the Monitor.  They can be
modified under Settings, Manage Users.  Their role is defined as "agent".
 
Agent Username [agent]: emagent
 
Agent Password :
Re-enter :
----------------------------------------------------------------------------
Configuration Report
 
 
 
MySQL Enterprise Monitor Agent (Version 3.0.21.3149)
 
The settings you specified are listed below.
 
Note that if you are using a Connector to collect Query Analyzer data,
you will need some of these settings to configure the Connector. See
the following for more information:
http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-qanal-using-feeding.html
 
Installation directory: /mysql/mysql/enterprise/agent
 
MySQL Enterprise Monitor UI:
-------------------------
Hostname or IP address: mysql03
Tomcat Server Port: 18443
Use SSL: yes
 
 
Press [Enter] to continue :
 
----------------------------------------------------------------------------
Start MySQL Enterprise Monitor Agent
 
Info to start the MySQL Enterprise Monitor Agent
 
The MySQL Enterprise Monitor Agent was successfully installed. To start the
Agent please invoke:
/mysql/mysql/enterprise/agent/etc/init.d/mysql-monitor-agent start
 
Press [Enter] to continue :
 
----------------------------------------------------------------------------
Setup has finished installing MySQL Enterprise Monitor Agent on your computer.
 
View Agent Readme File [Y/n]: n
 
[mysql@mysql01 repo]$ /mysql/mysql/enterprise/agent/etc/init.d/mysql-monitor-agent start
Starting MySQL Enterprise Agent service... SUCCESS!




 


Fixing missing RPM issues when install mysql workbench on Oracle Linux

$
0
0

[root@mysql03 repo]# yum localinstall ./mysql-workbench-commercial-6.3.3-1.el7.x86_64.rpm
Loaded plugins: langpacks
Examining ./mysql-workbench-commercial-6.3.3-1.el7.x86_64.rpm: mysql-workbench-commercial-6.3.3-1.el7.x86_64
Marking ./mysql-workbench-commercial-6.3.3-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql-workbench-commercial.x86_64 0:6.3.3-1.el7 will be installed
--> Processing Dependency: tinyxml for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: libzip for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: python-paramiko for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: proj for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: libodbcinst.so.2()(64bit) for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: libodbc.so.2()(64bit) for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package mysql-workbench-commercial.x86_64 0:6.3.3-1.el7 will be installed
--> Processing Dependency: tinyxml for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: python-paramiko for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: proj for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
---> Package unixODBC.x86_64 0:2.3.1-10.el7 will be installed
--> Finished Dependency Resolution
Error: Package: mysql-workbench-commercial-6.3.3-1.el7.x86_64 (/mysql-workbench-commercial-6.3.3-1.el7.x86_64)
           Requires: python-paramiko
Error: Package: mysql-workbench-commercial-6.3.3-1.el7.x86_64 (/mysql-workbench-commercial-6.3.3-1.el7.x86_64)
           Requires: proj
Error: Package: mysql-workbench-commercial-6.3.3-1.el7.x86_64 (/mysql-workbench-commercial-6.3.3-1.el7.x86_64)
           Requires: tinyxml
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
 

 These packages could be found in EPEL.
EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux.
 

[root@mysql03 repo]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
--2015-06-03 20:04:48--  http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.23, 209.132.181.27, 209.132.181.24, ...
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.23|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14524 (14K) [application/x-rpm]
Saving to: ‘epel-release-7-5.noarch.rpm’
 
100%[=============================================================================================================>] 14,524      75.9KB/s   in 0.2s
 
2015-06-03 20:04:50 (75.9 KB/s) - ‘epel-release-7-5.noarch.rpm’ saved [14524/14524]
 
[root@mysql03 repo]# yum localinstall epel-release-7-5.noarch.rpm
Loaded plugins: langpacks
Examining epel-release-7-5.noarch.rpm: epel-release-7-5.noarch
Marking epel-release-7-5.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-5 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=======================================================================================================================================================
 Package                             Arch                          Version                       Repository                                       Size
=======================================================================================================================================================
Installing:
 epel-release                        noarch                        7-5                           /epel-release-7-5.noarch                         24 k
 
Transaction Summary
=======================================================================================================================================================
Install  1 Package
 
Total size: 24 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-5.noarch                                                                                                             1/1
  Verifying  : epel-release-7-5.noarch                                                                                                             1/1
 
Installed:
  epel-release.noarch 0:7-5
 

 

[root@mysql03 repo]# yum localinstall ./mysql-workbench-commercial-6.3.3-1.el7.x86_64.rpm
Loaded plugins: langpacks
Examining ./mysql-workbench-commercial-6.3.3-1.el7.x86_64.rpm: mysql-workbench-commercial-6.3.3-1.el7.x86_64
Marking ./mysql-workbench-commercial-6.3.3-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql-workbench-commercial.x86_64 0:6.3.3-1.el7 will be installed
--> Processing Dependency: tinyxml for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: libzip for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: python-paramiko for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: proj for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: libodbcinst.so.2()(64bit) for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Processing Dependency: libodbc.so.2()(64bit) for package: mysql-workbench-commercial-6.3.3-1.el7.x86_64
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package proj.x86_64 0:4.8.0-4.el7 will be installed
---> Package python-paramiko.noarch 0:1.15.1-1.el7 will be installed
--> Processing Dependency: python-crypto >= 2.1 for package: python-paramiko-1.15.1-1.el7.noarch
--> Processing Dependency: python-ecdsa for package: python-paramiko-1.15.1-1.el7.noarch
---> Package tinyxml.x86_64 0:2.6.2-3.el7 will be installed
---> Package unixODBC.x86_64 0:2.3.1-10.el7 will be installed
--> Running transaction check
---> Package python-crypto.x86_64 0:2.6.1-1.el7 will be installed
---> Package python-ecdsa.noarch 0:0.11-3.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
============================================================================================
 Package           Arch   Version      Repository                                      Size
============================================================================================
Installing:
 mysql-workbench-commercial
                   x86_64 6.3.3-1.el7  /mysql-workbench-commercial-6.3.3-1.el7.x86_64 119 M
Installing for dependencies:
 libzip            x86_64 0.10.1-8.el7 ol7_latest                                      47 k
 proj              x86_64 4.8.0-4.el7  epel                                           181 k
 python-crypto     x86_64 2.6.1-1.el7  epel                                           469 k
 python-ecdsa      noarch 0.11-3.el7   epel                                            69 k
 python-paramiko   noarch 1.15.1-1.el7 epel                                           999 k
 tinyxml           x86_64 2.6.2-3.el7  epel                                            49 k
 unixODBC          x86_64 2.3.1-10.el7 ol7_latest                                     407 k
 
Transaction Summary
============================================================================================
Install  1 Package (+7 Dependent packages)
 
Total size: 121 M
Total download size: 2.2 M
Installed size: 128 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/epel/packages/python-paramiko-1.15.1-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for python-paramiko-1.15.1-1.el7.noarch.rpm is not installed
(1/7): python-paramiko-1.15.1-1.el7.noarch.rpm                       | 999 kB  00:00:02
(2/7): tinyxml-2.6.2-3.el7.x86_64.rpm                                |  49 kB  00:00:00
(3/7): python-ecdsa-0.11-3.el7.noarch.rpm                            |  69 kB  00:00:05
(4/7): unixODBC-2.3.1-10.el7.x86_64.rpm                              | 407 kB  00:00:04
(5/7): libzip-0.10.1-8.el7.x86_64.rpm                                |  47 kB  00:00:08
(6/7): python-crypto-2.6.1-1.el7.x86_64.rpm                          | 469 kB  00:00:08
(7/7): proj-4.8.0-4.el7.x86_64.rpm                                   | 181 kB  00:00:08
--------------------------------------------------------------------------------------------
Total                                                       255 kB/s | 2.2 MB  00:00:08
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) "
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-5.noarch (@/epel-release-7-5.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : tinyxml-2.6.2-3.el7.x86_64                                               1/8
  Installing : libzip-0.10.1-8.el7.x86_64                                               2/8
  Installing : python-ecdsa-0.11-3.el7.noarch                                           3/8
  Installing : unixODBC-2.3.1-10.el7.x86_64                                             4/8
warning: /etc/odbcinst.ini created as /etc/odbcinst.ini.rpmnew
  Installing : python-crypto-2.6.1-1.el7.x86_64                                         5/8
  Installing : python-paramiko-1.15.1-1.el7.noarch                                      6/8
  Installing : proj-4.8.0-4.el7.x86_64                                                  7/8
  Installing : mysql-workbench-commercial-6.3.3-1.el7.x86_64                            8/8
  Verifying  : proj-4.8.0-4.el7.x86_64                                                  1/8
  Verifying  : python-crypto-2.6.1-1.el7.x86_64                                         2/8
  Verifying  : mysql-workbench-commercial-6.3.3-1.el7.x86_64                            3/8
  Verifying  : unixODBC-2.3.1-10.el7.x86_64                                             4/8
  Verifying  : python-ecdsa-0.11-3.el7.noarch                                           5/8
  Verifying  : libzip-0.10.1-8.el7.x86_64                                               6/8
  Verifying  : tinyxml-2.6.2-3.el7.x86_64                                               7/8
  Verifying  : python-paramiko-1.15.1-1.el7.noarch                                      8/8
 
Installed:
  mysql-workbench-commercial.x86_64 0:6.3.3-1.el7
 
Dependency Installed:
  libzip.x86_64 0:0.10.1-8.el7                    proj.x86_64 0:4.8.0-4.el7
  python-crypto.x86_64 0:2.6.1-1.el7              python-ecdsa.noarch 0:0.11-3.el7
  python-paramiko.noarch 0:1.15.1-1.el7           tinyxml.x86_64 0:2.6.2-3.el7
  unixODBC.x86_64 0:2.3.1-10.el7
 
Complete!
[root@mysql03 repo]#

 

Recover lost of redo log scenarios with database clean shutdown

$
0
0
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ rm redo0*
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 17 07:21:29 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size                  3003176 bytes
Variable Size             838864088 bytes
Database Buffers          402653184 bytes
Redo Buffers               13770752 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 2365
Session ID: 1 Serial number: 24573

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 17 07:22:14 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size                  3003176 bytes
Variable Size             838864088 bytes
Database Buffers          402653184 bytes
Redo Buffers               13770752 bytes
Database mounted.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required


SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jun 17 07:23:13 2015

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL2 (DBID=846932035, not open)

RMAN> recover database;

Starting recover at 17-JUN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 17-JUN-15

RMAN> alter database open resetlogs;

Statement processed

Recover database after lost redo+control files (with database clean shutdown)

$
0
0
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ rm redo0*
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ rm control01.ctl
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ rm "/u01/app/oracle/fast_recovery_area/orcl2/control02.ctl"

oracle@solaris112:/u01/app/oracle/oradata/orcl2$ ls -ltr
total 5650988
-rw-r-----   1 oracle   oinstall 62922752 Jun 17 07:24 temp01.dbf
-rw-r-----   1 oracle   oinstall 817897472 Jun 17 07:25 system01.dbf
-rw-r-----   1 oracle   oinstall 639639552 Jun 17 07:25 sysaux01.dbf
-rw-r-----   1 oracle   oinstall 83894272 Jun 17 07:25 undotbs01.dbf
-rw-r-----   1 oracle   oinstall 1340874752 Jun 17 07:25 example01.dbf
-rw-r-----   1 oracle   oinstall 5251072 Jun 17 07:25 users01.dbf
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 17 07:30:20 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size                  3003176 bytes
Variable Size             838864088 bytes
Database Buffers          402653184 bytes
Redo Buffers               13770752 bytes
SQL> set echo on
SQL> @/tmp/recreate_control.sql
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL2" RESETLOGS  NOARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u01/app/oracle/oradata/orcl2/redo01.log' SIZE 50M BLOCKSIZE 512,
  9    GROUP 2 '/u01/app/oracle/oradata/orcl2/redo02.log' SIZE 50M BLOCKSIZE 512,
 10    GROUP 3 '/u01/app/oracle/oradata/orcl2/redo03.log' SIZE 50M BLOCKSIZE 512
 11  -- STANDBY LOGFILE
 12  DATAFILE
 13    '/u01/app/oracle/oradata/orcl2/system01.dbf',
 14    '/u01/app/oracle/oradata/orcl2/sysaux01.dbf',
 15    '/u01/app/oracle/oradata/orcl2/undotbs01.dbf',
 16    '/u01/app/oracle/oradata/orcl2/example01.dbf',
 17    '/u01/app/oracle/oradata/orcl2/users01.dbf'
 18  CHARACTER SET WE8MSWIN1252
 19  ;

Control file created.

SQL>
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01100: database already mounted


SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
oracle@solaris112:/u01/app/oracle/oradata/orcl2$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jun 17 07:32:31 2015

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL2 (DBID=846932035, not open)

RMAN> alter database open resetlogs;

using target database control file instead of recovery catalog
Statement processed

RMAN> exit
Recovery Manager complete.

racle@solaris112:/u01/app/oracle/oradata/orcl2$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 17 07:33:19 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

Viewing all 604 articles
Browse latest View live