WebLogic 9.2 Loadbalancing problem - load-balancing

I have a setup of 2 independent WebLogic 9.2.1 servers (they are Managed servers with their own Admin server). So no Clustering has been setup. They are configured with JDBC Session Persistence. Furthermore each of the WebLogic servers have their own Apache 2 Front-End with the WebLogic plugin only forwarding traffic to their respective WebLogic server.
In front of the Apache 2 servers I have a hardware Load Balancer.
Currently we are getting Constraint Violations from the Oracle database that hosts the table used for session persistence.
I found out that the hardware load balancer is using sticky IP's (so sessions should also be sticky as a result). But it escapes me what is wrong in the setup?
WebLogic log:
####<Apr 26, 2011 13:00:08.0428 CEST> <Error> <HTTP Session> <sktpens01por02> <SktEnsPorServer1> <[ACTIVE] ExecuteThread: '230' for queue: 'weblogic.kernel.Default (self-tuning)'> <skatGuid=6fa90948-b285-45a5-954b-45e22bfc26c2,ou=company,ou=external,ou=entities,dc=skat,dc=dk> <> <> <1303815608428> <BEA-100087> <The jdbc session data for session id: lZbJN2jTbPZjTf81vSrKytxDdYCpwTgblJhnck3RhTcPf3FQr1Pw ctx:front dblat:1303815595796 triggerLAT:0 has been modified by another server in the cluster.
java.sql.SQLException: ORA-00001: unique constraint (FRONTSESSIONS.SYS_C0056504) violated
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3454)
at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:128)
at weblogic.servlet.internal.session.JDBCSessionData.dbCreate(JDBCSessionData.java:181)
at weblogic.servlet.internal.session.JDBCSessionData.dbUpdate(JDBCSessionData.java:242)
at weblogic.servlet.internal.session.JDBCSessionData.syncSession(JDBCSessionData.java:583)
at weblogic.servlet.internal.session.JDBCSessionContext.sync(JDBCSessionContext.java:232)
at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.syncSession(ServletRequestImpl.java:2507)
at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.syncSession(ServletRequestImpl.java:2482)
at weblogic.servlet.internal.ServletResponseImpl$1.run(ServletResponseImpl.java:1308)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1302)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1368)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
>
####<Apr 26, 2011 13:00:08.0436 CEST> <Error> <HTTP Session> <sktpens01por02> <SktEnsPorServer1> <[ACTIVE] ExecuteThread: '230' for queue: 'weblogic.kernel.Default (self-tuning)'> <skatGuid=6fa90948-b285-45a5-954b-45e22bfc26c2,ou=company,ou=external,ou=entities,dc=skat,dc=dk> <> <> <1303815608436> <BEA-100060> <An unexpected error occurred while retrieving the session for Web application: weblogic.servlet.internal.WebAppServletContext#26f86bfb - appName: 'Portal-Front', name: 'front', context-path: '/front'.
java.sql.SQLException: ORA-00001: unique constraint (FRONTSESSIONS.SYS_C0056504) violated
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3454)
at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:128)
at weblogic.servlet.internal.session.JDBCSessionData.dbCreate(JDBCSessionData.java:181)
at weblogic.servlet.internal.session.JDBCSessionData.dbUpdate(JDBCSessionData.java:242)
at weblogic.servlet.internal.session.JDBCSessionData.syncSession(JDBCSessionData.java:583)
at weblogic.servlet.internal.session.JDBCSessionContext.sync(JDBCSessionContext.java:232)
at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.syncSession(ServletRequestImpl.java:2507)
at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.syncSession(ServletRequestImpl.java:2482)
at weblogic.servlet.internal.ServletResponseImpl$1.run(ServletResponseImpl.java:1308)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1302)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1368)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
>
Oracle Table definition:
CREATE TABLE "FRONTSESSIONS"."WL_SERVLET_SESSIONS"
(
"WL_ID" VARCHAR2(100 BYTE) NOT NULL ENABLE,
"WL_CONTEXT_PATH" VARCHAR2(100 BYTE) NOT NULL ENABLE,
"WL_IS_NEW" CHAR(1 BYTE),
"WL_CREATE_TIME" NUMBER(20,0),
"WL_IS_VALID" CHAR(1 BYTE),
"WL_SESSION_VALUES" LONG RAW,
"WL_ACCESS_TIME" NUMBER(20,0),
"WL_MAX_INACTIVE_INTERVAL" NUMBER(*,0),
PRIMARY KEY ("WL_ID", "WL_CONTEXT_PATH") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "FRONTSESSIONS" ENABLE
)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
(
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
)
TABLESPACE "FRONTSESSIONS" ;
Thanks!

The fact that those are 2 independent servers (without clustering in WebLogic sense) does not stop WebLogic to generate same ids for sessions. If those 2 servers where in a cluster, then WebLogic would add node id as part of the session id. But becuase servers are not in the cluster, of course, there is a chance that at some point they will generate same session id.
The only way you can avoid that exception is to configure both servers to use different tables or database for session storage.

Related

Why is my SQL query in which I am doing a MAX and ORDER BY in 2 tables taking a long time

Hi I do not know a whole lot about SQL this is definitely one of my weak points. this is an Oracle DB.
I have 2 tables:
TAXI_ROUTES_TABLE:
ID | ORIGIN | DESTINATION | TAXI_NUMBER | STOPS | DAY_OF_OPERATION | INSERT_DATE
123 NORTH AVE CAMPBELL 1552 1W;2T;4Y 01-FEB-20 27-DEC-19
124 LEMMON AVE HENRY ST 1511 1R;5G;P3 02-FEB-20 25-DEC-19
TAXI_FARE_TABLE:
ID | ORIGIN | DESTINATION | TAXI_NUMBER | STOPS | FARE_TYPE | FARE_TYPE_AVAIL
123 NORTH AVE CAMPBELL 1552 1W;2T;4Y SENIOR 5
123 NORTH AVE CAMPBELL 1552 1W;2T;4Y STUDENT 10
123 NORTH AVE CAMPBELL 1552 1W;2T;4Y EMPLOYEE 10
124 LEMMON AVE HENRY ST 1511 1R;5G;P3 SENIOR 5
124 LEMMON AVE HENRY ST 1511 1R;5G;P3 STUDENT 3
124 LEMMON AVE HENRY ST 1511 1R;5G;P3 EMPLOYEE 10
TAXI_ROUTES_TABLE INDEX:
STOPS, TAXI_NUMBER, DESTINATION, ORIGIN, DAY_OF_OPERATION
CREATE INDEX "TAXI_ADMIN"."IX01_TAXI_ROUTES_TABLE" ON
"TAXI_ADMIN"."TAXI_ROUTES_TABLE" ("STOPS", "TAXI_NUMBER", "DESTINATION",
"ORIGIN", "DAY_OF_OPERATION ")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TAXI_ADMIN" ;
TAXI_FARE_TABLE does not have any indexes.
These tables have millions of records in them. the same records are in both tables its just that the taxi fare table has them repeated due to the types of fares for each taxi.
so I am trying to do a join to be able to get all the most recently inserted records and the fare types for them. So I should only get back the records inserted on 27-DEC-19.
My problem: my query is maxing out the time limit, its taking forever. I would really appreciate your guidance on this.
SQL:
SELECT R.ID,
R.ORIGIN,
R.DESTINATION,
R.TAXI_NUMBER,
R.STOPS,
R.DAY_OF_OPERATION,
R.INSERT_DATE,
F.FARE_TYPE,
F.FARE_TYPE_AVAIL
FROM TAXI_ADMIN.TAXI_ROUTES_TABLE R, TAXI_ADMIN.TAXI_FARE_TABLET F
WHERE INSERT_DATE = (SELECT MAX(INSERT_DATE) FROM TAXI_ADMIN.TAXI_ROUTES_TABLE)
AND R.ID = F.ID
ORDER BY R.ORIGIN, R.DESTINATION, R.DAY_OF_OPERATION;
I am not sure how can I make the query faster. When I run without the order by its pretty quick but the order by takes a really long time.
thank you
I would recommend identifying the SQL id for the query then using the SQL Monitor Report as it will tell you exactly what the execution plan is and where the SQL is spending most of it's time.
A simple way to get the SQL Monitor Report from SQL*Plus follows:
spool c:\temp\SQL_Monitor_rpt.html
SET LONG 1000000
SET LONGCHUNKSIZE 1000000
SET LINESIZE 1000
SET PAGESIZE 0
SET TRIM ON
SET TRIMSPOOL ON
SET ECHO OFF
SET FEEDBACK OFF
alter session set "_with_subquery" = optimizer;
SELECT DBMS_SQLTUNE.report_sql_monitor(
sql_id => '&SQLID' ,
type => 'HTML',
report_level => 'ALL') AS report
FROM dual;
spool off
Also, in this case you probably need three more indexes:
TAXI_ADMIN.TAXI_ROUTES_TABLE.INSERT_DATE to cover the subset condition
and the ID column on both tables to cover the join condition
For this query (which I've cleaned up a bit):
SELECT R.ID, R.ORIGIN, R.DESTINATION, R.TAXI_NUMBER,
R.STOPS, R.DAY_OF_OPERATION, R.INSERT_DATE,
F.FARE_TYPE, F.FARE_TYPE_AVAIL
FROM TAXI_ADMIN.TAXI_ROUTES_TABLE R JOIN
TAXI_ADMIN.TAXI_FARE_TABLET F
ON R.ID = F.ID
WHERE R.INSERT_DATE = (SELECT MAX(R2.INSERT_DATE) FROM TAXI_ADMIN.TAXI_ROUTES_TABLE R2)
ORDER BY R.ORIGIN, R.DESTINATION, R.DAY_OF_OPERATION;
You want indexes on: TAXI_ROUTES_TABLE(INSERT_DATE, ID) and TAXI_FARE_TABLET(ID). It is hard to eliminate the overhead for the ORDER BY. So if there is a lot of data, this may not help a lot.
If Oracle is smart enough, then extending the first index to TAXI_ROUTES_TABLE(INSERT_DATE, ORIGIN, DESTINATION, DAY_OF_OPERATION, ID) would help. This is an interesting optimization, because it would need to take the ORDER BY into account before doing the JOIN.

How to turn off mixed data and log in Sybase ASE 15.7?

When I use sp_helpdb in Sybase ASE 15.7 my result:
db_abc 2054.0 MB sa trunc log on chkpt, mixed log and data
db_def 1030.0 MB sa trunc log on chkpt, mixed log and data
Could I turn off mixed log and data?
I tried with sp_dboption db_abc , 'mixed log and data', false
But show error Sybase Database Error: The database option does not exist or you cannot set the option. While sp_dboption db_abc , 'abort tran on log full', false in other case is Ok.
The mixed log + data is not a switch. It is an effect of the way the database is created (and how pages are mixed in the same area). You can not switch it off. You need separate the LOG from DATA to achieve your goal.
Since on the current devices you have both LOG and DATA pages you need to:
add another device that is planned only for log (alter database .. log on ..)
switch on single user mode
move the log to the new created device with sp_logdevice procedure
switch off single user mode
Code example:
1> disk init name = dev1, physname = '/tmp/dev1.dat', size = '200M'
2> go
create database db_abc on dev1 = '200M'
2> go
CREATE DATABASE: allocating 102400 logical pages (200.0 megabytes) on disk 'dev1' (102400 logical pages requested).
Database 'db_abc' is now online.
1> exec sp_dboption 'db_abc', 'trunc log on chkpt', true
2> go
Database option 'trunc log on chkpt' turned ON for database 'db_abc'.
Running CHECKPOINT on database 'db_abc' for option 'trunc log on chkpt' to take effect.
(return status = 0)
1> exec sp_helpdb 'db_abc'
2> go
name db_size owner dbid created durability lobcomplvl inrowlen status
------ ------------- ----- ---- ------------ ---------- ---------- -------- --------------------------------------
db_abc 200.0 MB sa 4 Jul 07, 2017 full 0 NULL trunc log on chkpt, mixed log and data
(1 row affected)
device_fragments size usage created free_kbytes
---------------- ------------- ------------ ------------------- ----------------
dev1 200.0 MB data and log Jul 7 2017 9:56AM 202232
(return status = 0)
1> disk init name = dev2, physname = '/tmp/dev2.dat', size = '100M'
2> go
1> alter database db_abc log on dev2 = '100M'
2> go
Extending database by 51200 pages (100.0 megabytes) on disk dev2
Warning: Using ALTER DATABASE to extend the log segment will cause user thresholds on the log segment within 128 pages of the last chance threshold to be disabled.
1> exec sp_dboption 'db_abc', 'single user', true
2> go
Database option 'single user' turned ON for database 'db_abc'.
Running CHECKPOINT on database 'db_abc' for option 'single user' to take effect.
(return status = 0)
1> exec sp_logdevice 'db_abc', 'dev2'
2> go
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.
syslogs moved.
The last-chance threshold for database db_abc is now 16 pages.
(return status = 0)
1> exec sp_dboption 'db_abc', 'single user', false
2> go
Database option 'single user' turned OFF for database 'db_abc'.
Running CHECKPOINT on database 'db_abc' for option 'single user' to take effect.
(return status = 0)
1> exec sp_helpdb 'db_abc'
2> go
name db_size owner dbid created durability lobcomplvl inrowlen status
------ ------------- ----- ---- ------------ ---------- ---------- -------- --------------------------------------
db_abc 300.0 MB sa 4 Jul 07, 2017 full 0 NULL trunc log on chkpt, mixed log and data
(1 row affected)
device_fragments size usage created free_kbytes
---------------- ------------- --------- ------------------- ----------------
dev1 200.0 MB data only Jul 7 2017 9:56AM 202248
dev2 100.0 MB log only Jul 7 2017 9:57AM not applicable
--------------------------------------------------------------------------------------------------------------
log only free kbytes = 102000
(return status = 0)

Total duration of the route with time windows is not optimal

I prepared a test case illustrating the problem.
The route consists of three points:
1001 - depot.
1002 - timewindow 10:00-15:00.
1003 - timewindow 8:00-15:00.
I expected that the route will be 1001-1003-1002, but received 1001-1002-1003.
As I understand, soft score constraint doesn't optimize downtime interval = readyTime - arrivalTime.
Although total travel time is minimal (calculated only by the matrix), but the total duration of the route now is more than could be.
Can I somehow optimize total route duration?
Thanks in advance.
Vrp file:
NAME: P1568C3-n3-k1
COMMENT: P1568C3-n3-k1
TYPE: CVRPTW
DIMENSION: 3
EDGE_WEIGHT_TYPE: EXPLICIT
EDGE_WEIGHT_FORMAT: FULL_MATRIX
EDGE_WEIGHT_UNIT_OF_MEASUREMENT: SEC
CAPACITY: 4
NODE_COORD_SECTION
1001 52.086 23.687 address
1002 52.089 23.71 address
1003 52.095 23.742 address
EDGE_WEIGHT_SECTION
0 0.1675 0.4053
0.1675 0 0.2378
0.4893 0.3218 0
DEMAND_SECTION
1001 0 21600 54000 0
1002 1 36000 54000 1800
1003 1 28800 54000 1800
DEPOT_SECTION
1001
-1
EOF
Result xml:
<vehicleList id="11">
<VrpVehicle id="12">
<id>0</id>
<capacity>4</capacity>
<depot class="VrpTimeWindowedDepot" reference="10"/>
<nextCustomer class="VrpTimeWindowedCustomer" id="13">
<id>1002</id>
<location class="VrpRoadLocation" reference="5"/>
<demand>1</demand>
<previousStandstill class="VrpVehicle" reference="12"/>
<nextCustomer class="VrpTimeWindowedCustomer" id="14">
<id>1003</id>
<location class="VrpRoadLocation" reference="7"/>
<demand>1</demand>
<previousStandstill class="VrpTimeWindowedCustomer" reference="13"/>
<vehicle reference="12"/>
<readyTime>28800</readyTime>
<dueTime>54000</dueTime>
<serviceDuration>1800</serviceDuration>
<arrivalTime>38038</arrivalTime>
</nextCustomer>
<vehicle reference="12"/>
<readyTime>36000</readyTime>
<dueTime>54000</dueTime>
<serviceDuration>1800</serviceDuration>
<arrivalTime>36000</arrivalTime>
</nextCustomer>
</VrpVehicle>
</vehicleList>
In the optaplanner-examples implementation, which follows the academic paper's problem definition, the score implementation soft score is only the time spend on the road. The current score constraints do not include any penalty for lost time (if any) of vehicles before leaving the depot.
You can see that in the example UI if you click on the bottom left button "constraint matches":
-489 for driving back to the depot
-406: -168 for driving from the depot to closest customer and -238 to drive to other customer.
So OptaPlanner does return the optimal solution, you just have a different problem definition. Simply add a soft constraint to penalize the depot's opening time till the departure time.

Can a clustered index help in this scenario?

We have 2 tables dispense and dispensedetail. On Dispense there is a foreign key PatientID.
Most processes and queries are in the context of a patient.
Currently the dispense table has a non-clustered index (DispenseID, PatientID).
The DispenseDetail has DispenseDetailID as primary key and a non-clustered index (DispenseID).
We are noticing some slowness that is caused by pageIo latches (sh) as sql server has to bring data from disk into memory.
I am thinking about a clustered index (DispenseID,DispenseDetailID) which can help retrieve the dispense details of a particular patient but it may worsen the insert dispense.. Dispense inserts are more important as without them there won't be data to query.
Will a non-clustered index (DispenseID,DispenseDetailID) help any?
Any comments or thoughts will be much appreciated.
Thanks!
Information for sqlonly
There are 4 physical CPUs each with 6 cores totalling 24 cores. There are 32 virtual CPUs.
The database is on a VM where there are 4 physical CPUs each with 6 cores totally 24 cores.and there are 32 virtual CPUs.
The dispense table has 4000000+ rows. The dispense detail has 11000000+ rows.
I don't know how to compute or get the average page io latch wait time. Querying sys.dm_os_latch_stats and ordering by wait time, this is the result set:
latch_class waiting_requests_count wait_time_ms max_wait_time_ms
BUFFER 62658377 97584783 12051
ACCESS_METHODS_DATASET_PARENT 950195 7870081 19652
ACCESS_METHODS_HOBT_VIRTUAL_ROOT 799403 5071290 5692
BACKUP_OPERATION 785245 372930 206
LOG_MANAGER 7 40403 11235
ACCESS_METHODS_HOBT_COUNT 7959 19728 1587
NESTING_TRANSACTION_FULL 122342 7969 59
ACCESS_METHODS_ACCESSOR_CACHE 67877 5143 65
ACCESS_METHODS_BULK_ALLOC 1644 734 49
ACCESS_METHODS_HOBT 15 76 15
SPACEMGR_ALLOCEXTENT_CACHE 169 71 10
SPACEMGR_IAM_PAGE_RANGE_CACHE 68 49 4
NESTING_TRANSACTION_READONLY 1942 11 1
SERVICE_BROKER_WAITFOR_MANAGER 31 9 4
TRACE_CONTROLLER 1 1 1
APPEND_ONLY_STORAGE_FIRST_ALLOC 11 1 1
In dev I used the current indexes to get just dispenseID and dispenseDetailID for the patient -- the outcome it is an index seek. However that result set must be inserted into a temp table to get other fields and the insert to temp table is costly so the net is no improvement gained.
Thanks!

SQL server "Cannot send mails to mail server" "Failure sending mail"

I am using MS SQL Server 2008 R2 SP2 Express edition, 64 bit.
I do not have access to the Database Mail setup wizard, but the Binn directory contains DatabaseMail.exe (v10.50.16600.1) and DatabaseMailengine.dll.
I found several references to "Cannot send mails to mail server", but nothing useful with the annoyingly generic "Failure sending mail" message.
My specific question is where can I find out what that error message means/what causes it? If some kind soul would care to hazard a guess about what is going on, or not going on, I would appreciate it.
Setup info from the database follows:
EXECUTE sp_configure 'show advanced'
name minimum maximum config_value run_value
show advanced options 0 1 1 1
EXECUTE sp_configure 'Database Mail XPs'
name minimum maximum config_value run_value
Database Mail XPs 0 1 1 1
sysmail_server
account_id servertype servername port username credential_id use_default_credentials enable_ssl flags timeout last_mod_datetime last_mod_user
1 SMTP smtp.gmail.com 465 sqlmail#domain.com 65536 0 1 0 NULL 2015-11-23 09:34:26.913 WSCORP\username
sys.credentials
credential_id name credential_identity create_date modify_date target_type target_id
65536 F05ADE33-6AA8-45FC-8FF5-A7631831ECB1 sqlmail#domain.com 2015-11-23 09:34:26.913 2015-11-23 09:34:26.913 NULL NULL
EXEC msdb.sys.sp_helprolemember 'DatabaseMailUserRole'
DbRole MemberName MemberSID
DatabaseMailUserRole WSCORP\username 0x010500000000000515000000F483990DEADF2220C7DB306E6B040000
EXEC msdb.dbo.sysmail_help_principalprofile_sp
principal_id principal_name profile_id profile_name is_default
27 WSCORP\username 1 Default 1
EXECUTE dbo.sysmail_start_sp
Status
STARTED
sysmail_account
account_id name description email_address display_name replyto_address last_mod_datetime last_mod_user
1 SQLMail NULL sqlmail#domain.com SQLExpresspay12 Mail user#domain.com 2015-11-23 09:34:26.843 WSCORP\username
sysmail_profile
profile_id name description last_mod_datetime last_mod_user
1 Default Default profile 2015-11-23 09:56:58.947 WSCORP\username
sysmail_profileaccount
profile_id account_id sequence_number last_mod_datetime last_mod_user
1 1 1 2015-11-23 10:02:29.867 WSCORP\username
sysmail_servertype
servertype is_incoming is_outgoing last_mod_datetime last_mod_user
SMTP 0 1 2010-04-02 17:36:17.340 sa
sysmail_mailitems
mailitem_id profile_id recipients copy_recipients blind_copy_recipients subject from_address reply_to body body_format importance sensitivity file_attachments attachment_encoding query execute_query_database attach_query_result_as_file query_result_header query_result_width query_result_separator exclude_query_output append_query_error send_request_date send_request_user sent_account_id sent_status sent_date last_mod_date last_mod_user
4 1 user#domain.com NULL NULL Test message NULL NULL This is the body of the test message. TEXT NORMAL NORMAL NULL MIME NULL NULL 0 1 256 0 0 0 2015-11-24 08:23:59.493 WSCORP\username NULL 2 11/1124/20158 8:25:20 11/24/2015 08:25:20 sa
Congratulations, Database Mail Received
By you Successfully.
sysmail_log
log_id event_type log_date description process_id mailitem_id account_id last_mod_date last_mod_user
13 1 2015-11-24 08:23:59.787 DatabaseMail process is started 7324 NULL NULL 2015-11-24 08:23:59.787 NT AUTHORITY\NETWORK SERVICE
14 1 2015-11-24 08:24:10.270 The mail queue was started by login "WSCORP\username". NULL NULL NULL 2015-11-24 08:24:10.270 WSCORP\username
15 3 2015-11-24 08:24:10.297 The mail could not be sent to the recipients because of 7324 4 NULL 2015-11-24 08:24:10.297 sa
the mail server failure. (Sending Mail using Account 1
(2015-11-24T08:24:10). Exception Message: Cannot send
mails to mail server. (Failure sending mail.). )
Google wanted me to use the TLS port (587) even though, as far as I can tell, there was no way to tell the SQL server to use TLS. So specifying SSL and using the TLS port worked.